nonblocking reads in windows?

Joe Connellan joec at mill.co.uk
Wed Aug 28 04:55:23 EDT 2002


I think there is something wrong with my box - I've tried it on another machine and it works
fine. I'll wipe and reinstall python and see how that goes.

In the simplest case, the following doesn't work (serial uses win32file)

#########################################
import serial

com = serial.Serial("COM1", 9600, 0, 0, 1, 3, 1, 0) # set timeout of 3

com.write("\n\r0401rm\n\r")

print com.read(100)

#########################################

0401rm requests a reading from the device, on my machine I get nothing, on my friends I get the
data back from the reading.

Also I have noticed that after a reboot my machine (a laptop) wont even read from the com port
using os.open and os.read but after I connect to the device using hyperterminal, I can then read
it with os.open and os.read - until the next reboot. Maybe I've got flakey com ports, its a Dell
inspiron 8200.

Thanks for the help

Joe

Noah wrote:

> Oh, I should have known that those win32 files were different.
>
> Were you able to open the COM1 port and read any data at all?
> Send me the code you are using.
>
> Yours,
> Noah
>
> Joe Connellan <joec at mill.co.uk> wrote in message news:<3D6B5C9B.426C027A at mill.co.uk>...
> > unfortunately select does not work with files in win32. I've tried the win32all (win32file)
> > extensions and cannot get them to talk to my com port properly.
> >
> > Thanks
> >
> > Joe
> >




More information about the Python-list mailing list