nonblocking reads in windows?
joec at mill.co.uk
Tue Aug 27 15:40:52 CEST 2002
I ran that code without error and it seemed to write ok, but when I then read from it
I get nothing - the device I'm reading from replies to the input (even just a prompt
if something fails). If I run the code to do the write, then I connect to the device
through hyperterminal I get the response, so it seems the write is working ok. I have
now written what I need in c++, so it's not desperately important, just very strange.
I'll try to track down another pc or terminal so I can test it out further, at the
moment I don't have much to test with.
Thanks for the help
Jirka 'Eagle' Novak wrote:
> Joe Connellan wrote:
> > I'm on WinXP, there is no problem opening the com port, no errors, etc. But if I
> > try to write or read from it nothing happens - I know my com port works and the
> > config is correct as I can use it with os.read, etc.
> This code work for me. Are you *absolutely* sure you read data from the
> port correctly?
> import serial
> import serial.serialutil
> SEND_STR = "Hello, this is just a test.\n\r"
> comm = serial.Serial("COM1")
> raw_input("Press Enter to send data")
> raw_input("Press Enter to set RTS high.")
> raw_input("Press Enter to close port.")
> except serial.serialutil.SerialException:
> print ">>> Exception: could not open communication port"
> Jirka 'Eagle' Novak
> registered linux user #173581
> E-Mail: eagle at unicode.cz
> ICQ: 46044619
> HomePage: http://seal.unicode.cz/~eagle/
More information about the Python-list