Question re threading and serial i/o

Peter Hansen peter at engcorp.com
Fri Nov 7 10:29:57 EST 2003


Frank Millman wrote:
> 
> I changed
>     p = file('/dev/ttyS0')
>     p.read(1)
> to
>     p = os.open('/dev/ttyS0',os.O_RDONLY|os.O_NONBLOCK)
>     os.read(p,1)
> and it behaved correctly.
> 
> Out of interest, is there another way to open a serial port in
> non-blocking mode?

I think you're supposed to use module "fcntl" after opening with
the standard builtin open() method, rather than having to resort
to os.open().  Don't know the details.

-Peter




More information about the Python-list mailing list