[Tutor] Pyserial and invalid handle

John Smith jocjo.s at verizon.net
Sun Nov 28 16:55:19 CET 2010

Can anybody tell me why the handle below is invalid? I'm running Win7.


Python 2.7 (r27:82525, Jul  4 2010, 07:43:08) [MSC v.1500 64 bit 
(AMD64)] on win32
Type "copyright", "credits" or "license()" for more information.

 >>> import serial
 >>> ser = serial.Serial('com1', timeout = 5)
 >>> x = ser.read()

Traceback (most recent call last):
   File "<pyshell#2>", line 1, in <module>
     x = ser.read()
   File "E:\Python27\lib\site-packages\serial\serialwin32.py", line 236, 
in read
     raise SerialException("ReadFile failed (%s)" % ctypes.WinError())
SerialException: ReadFile failed ([Error 6] The handle is invalid.)

More information about the Tutor mailing list