#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0

    Trying to use PySerial, get the following:


    Windows 7 32-bit, Python 2.7.3, PySerial installed by pyserial-2.5.win32.exe

    Trying to use PySerial, get the following:

    >>> import serial
    Traceback (most recent call last):
    File "<interactive input>", line 1, in <module>
    File "F:\Python27\lib\site-packages\serial\__init__.pyw", line 19,
    in <module> from serialwin32 import *
    File "F:\Python27\lib\site-packages\serial\serialwin32.pyw", line 11,
    in <module> import ctypes
    File "F:\Python27\lib\ctypes\__init__.py", line 10, in <module>
    from _ctypes import Union, Structure, Array
    ImportError: No module named _ctypes
    >>>

    serial, and ctypes are listed as install modules.
    The exe installed the folder ctypes in a sub-folder of Python 27\Lib,
    and the folder serial in Python\Lib\site-packages.

    >>> import sys

    >>> print sys.path

    ['',
    'C:\\Windows\\system32\\python27.zip',
    'F:\\Python27\\DLLs',
    'F:\\Python27\\lib',
    'F:\\Python27\\lib\\plat-win',
    'F:\\Python27\\lib\\lib-tk',
    'F:\\Python27\\Lib\\site-packages\\pythonwin',
    'F:\\Python27',
    'F:\\Python27\\lib\\site-packages',
    'F:\\Python27\\lib\\site-packages\\win32',
    'F:\\Python27\\lib\\site-packages\\win32\\lib']

    >>>

    I've searched with Google, and the forums, and found nothing of any help.
  2. #2
  3. Contributing User
    Devshed Demi-God (4500 - 4999 posts)

    Join Date
    Aug 2011
    Posts
    4,714
    Rep Power
    480
    I just tried python 2.4 on a windows computer.

    import ctypes
    import sys
    print(sys.modules)

    ...
    _ctypes.pyd is in site-packages.



    Although in recent pythons ctypes is part of the distribution. Should be, at least.

    on linux system
    python2.7/lib-dynload/_ctypes.so

    reinstall your python?
    [code]Code tags[/code] are essential for python code and Makefiles!
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0
    Thanks for your answer. I will investigate that.

    I have found that, when one program attempts to import another program, it invariably fails.
    Since I seem to be the only one who has problems with these (downloaded) programs , I am inclined to think that it may have something to do with a path setting,.

    As a Python beginner, I may have a bad setting.

    Maybe someone could look at my path settings, listed in my first post?
  6. #4
  7. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Dec 2012
    Posts
    4
    Rep Power
    0

    [solved]


    [QUOTE=b49P23TIvg

    Although in recent pythons ctypes is part of the distribution.
    reinstall your python?[/QUOTE]

    Good call, thanks.

    I finally got time to uninstall, and reinstall Python, and all packages. I also realized that my directory structure was "less than optimal".

    Now that problem is solved, and now I have a couple of new ones but, since they are different, I will make a new thread if I can't solve them.

IMN logo majestic logo threadwatch logo seochat tools logo