On 11/28/2010 7:55 AM John Smith said...

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

TIA,
John


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)

What do you get when you add 'print ser' here? The docs at http://pyserial.sourceforge.net/shortintro.html show you should get something like

Serial<id=0xa81c10, open=False>(port='COM1', baudrate=19200, bytesize=8, parity='N', stopbits=1, timeout=None, xonxoff=0, rtscts=0)

So if you're getting an invalid handle error I'd expect you'd get something different.

Emile


 >>> 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.)
 >>>
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor



_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to