[Tutor] Pyserial and invalid handle
Emile van Sebille
emile at fenx.com
Mon Nov 29 23:20:33 CET 2010
On 11/29/2010 1:44 PM John Smith said...
> But, when I tried it in Python, I got the same as before:
>
>
> >>> import serial
> >>> ser = serial.Serial(0, timeout = 1)
out of curiosity, if you change the timeout above to 5....
> >>> ser
> Serial<id=0x225c240, open=True>(port='COM1', baudrate=9600, bytesize=8,
> parity='N', stopbits=1, timeout=1, xonxoff=False, rtscts=False,
> dsrdtr=False)
> >>> ser.read()
... does the delay before printing the traceback below take about 5 seconds?
>
> Traceback (most recent call last):
> File "<pyshell#3>", line 1, in <module>
> 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.)
> >>>
Emile
More information about the Tutor
mailing list