Aborting a read with pySerial

John Nagle nagle at animats.com
Sat Nov 7 00:27:55 EST 2009


    I'm using pySerial to read from a serial port.
One thread reads from the port, with no timeout.
Another thread handles output and other tasks.  This works
fine until I want to shut down the program.  I can't reliably
break the program out of the read when it's waiting.  On Windows,
closing the serial port will abort the read, but that seems to have no
effect on Linux.

    I know, I could put a timeout on the read and handle all those
null returns.  Is there a better way?

				John Nagle



More information about the Python-list mailing list