[python-win32] win32file.SetupComm Error Using PySerial in new Python 2.5.2 installation on 32 bit XP

Ron Jackson Ron at FascinatingElectronics.com
Sat Mar 8 06:26:15 CET 2008

I am setting up Python on a newly upgraded computer (AMD 64 X2 dual 
core) running 32 bit XP home. I installed the following packages:

Python 2.5.2 from python-2.5.2.msi
PySerial from pyserial-2.2win32.exe
Python extensions for windows from pywin32-210.win32-py2.5.exe

Running a test of my program (feserial.py) I get the following error:

Traceback (most recent call last):
   File "C:\Python25\Lib\site-packages\feserial.py", line 166, in <module>
     port_numbers = portList()
   File "C:\Python25\Lib\site-packages\feserial.py", line 22, in portList
     s = FEserial(i)
   File "C:\Python25\Lib\site-packages\serial\serialutil.py", line 156, 
in __init__
   File "C:\Python25\Lib\site-packages\serial\serialwin32.py", line 57, 
in open
     win32file.SetupComm(self.hComPort, 4096, 4096)
error: (1, 'SetupComm', 'Incorrect function.')

Lines 56-57 in serialwin32.py are:
         # Setup a 4k buffer
         win32file.SetupComm(self.hComPort, 4096, 4096)

This works just fine on my laptop computer, which was set up some time 
ago and has a slightly older version of Python.

So, why am I getting this error? I don't think PySerial has changed in a 
long time, but was there some recent change in pywin32? Some change in 
Python 2.5.2 that would account for this error? Something in the 
installation that I haven't properly done?

Thanks for the help!

   -- Ron

More information about the python-win32 mailing list