nonblocking reads in windows?
Jirka 'Eagle' Novak
eagle at unicode.cz
Tue Aug 27 07:47:28 EDT 2002
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"
try:
comm = serial.Serial("COM1")
comm.setRTS(0)
raw_input("Press Enter to send data")
comm.write(SEND_STR)
raw_input("Press Enter to set RTS high.")
comm.setRTS(1)
raw_input("Press Enter to close port.")
comm.close()
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
mailing list