on windows

Ben Sizer kylotan at
Wed Oct 26 11:04:38 CEST 2005

jas wrote:
> I am currently using subprocess to execute a command.  Then I read from
> it's stdout...however, this is hanging on a read..waiting for more
> bytes.  So what I would like is to timeout...and select.selec() seems
> to be what I need.  Except I don't have a socket, i have stdout.
> Any suggestions on how to do a timeout like with stdout?

I am not too familiar with any asynchronous I/O facilities in Python
beyond select, so in your situation I would use the threading module,
with the blocking read in one thread and your time-out in the main
thread. You could perhaps use an Event object here, which has the
time-out functionality for you.

Ben Sizer

More information about the Python-list mailing list