[Tutor] Pyserial and invalid handle

John Smith jocjo.s at verizon.net
Tue Nov 30 17:57:57 CET 2010

On 11/30/2010 10:37 AM, Walter Prins wrote:
> Hello John
> In any case, to fix it let's delete all instances of pySerial and then
> install it again, as follows:
> 1.) Open up your Python "site-packages" folder in Windows Explorer, e.g.
> open up:
> E:\Python27\lib\site-packages
> 2.) Delete any folder named "serial" that you may see.
> 3.) Delete any *file* name pyserial*.* that you may see, probably you'll
> see "pyserial-2.4-py2.7.egg", there may also be an info file.
> 4.) Open up a Python shell and confirm that you can't import pyserial
> anymore (e.g. "import serial" fails with e.g. "ImportError: No module
> named serial".  If it still imports then you still have some vestiges of
> the existing pyserial installation left over.
> 5.) After confirming the previous versions are gone, please try
> reinstalling it again from scratch.  (E.g. extract source to some
> suitable place and run "python setup.py install" from there, which
> copies the required files into site-packages etc.)
> 6.) After installing, confirm "import serial" works again, then try your
> test again.
> Apologies again for adding to the confusion, and hopefully we're getting
> closer. :-(
> Walter

Hi, Walter -

I did the above and then got this:

 >>> import serial

Traceback (most recent call last):
   File "<pyshell#0>", line 1, in <module>
     import serial
   File "E:\Python27\lib\site-packages\serial\__init__.py", line 18, in 
     from serialwin32 import *
   File "E:\Python27\lib\site-packages\serial\serialwin32.py", line 9, 
in <module>
     import win32file  # The base COM port and file IO functions.
ImportError: No module named win32file

I guess that file was included in 2.5 but not in 2.4?


More information about the Tutor mailing list