nonblocking reads in windows?

Thomas Jensen spam at ob_scure.dk
Fri Aug 23 13:01:48 CEST 2002


Hello Joe,
Joe Connellan wrote:
> I have opened a serial port and if there is nothing there to be read
> os.read() hangs whereas I want it to return "".
> 
> if I try to open the fd with
> port = os.open("COM1", os.O_RDWR | os.O_NONBLOCK)
> 
> I get an AttributeError saying that os has no attribute O_NONBLOCK. And
> the windows select module doesn't support filehandles so it seems I
> cannot do it that way either.
> 
> Is there any way I can do this on windows?

I don't use Windows much, but perhaps you could solve this using a 
thread and a queue? (modules threading and Queue)

/Thomas


-- 
Best Regards
Thomas Jensen
(remove underscore in email address to mail me)




More information about the Python-list mailing list