[Tutor] Pyserial and invalid handle

John Smith jocjo.s at verizon.net
Sun Nov 28 18:08:08 CET 2010


On 11/28/2010 10:57 AM, Emile van Sebille wrote:
> 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

Hi, Emile -

Okay. Here it is:

 >>> print ser
Serial<id=0x224c240, open=True>(port='COM1', baudrate=9600, bytesize=8, 
parity='N', stopbits=1, timeout=5, xonxoff=False, rtscts=False, 
dsrdtr=False)
 >>>

Thanks.
John


More information about the Tutor mailing list