[Tutor] Pyserial and invalid handle
wprins at gmail.com
Wed Dec 1 01:23:19 CET 2010
On 30 November 2010 16:57, John Smith <jocjo.s at verizon.net> wrote:
> 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
> 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?
Apparently so. Well, win32file is part of the PyWin32 package, which are a
set of modules that wrap many Windows API's. I'm not sure why it
was't/isn't required for PySerial 2.5 or whether as you say perhaps this
module is included in PySerial2.5 and isn't in 2.4.
But whatever the case may be, suffice it to say I've reproduced your issue
on my Win7 64bit box, and then resolved it by installing the PyWin32
modules. It's probably a good idea to install this package anyway -- if
you're working on Windows the PyWin32 modules are very useful - they
basically wrap and makes available a shedload of Windows specific API's to
Python. (Many people working with Python on Windows almost automatically
would install this, it's also why i didn't run into this issue in the first
place as I already had PyWin32 installed prior to testing my suggestion.
Anyway. To download and install PyWin32, go here: http://ur.ly/vLwv
Presumably you want the AMD64 (64 bit) Py2.7 version. Install it then try
your test again.
Fingers crossed. ;)
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor