select.select() on windows

J

jas

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 select.select with stdout?

Thanks
 
B

Ben Sizer

jas said:
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 select.select 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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,754
Messages
2,569,527
Members
44,998
Latest member
MarissaEub

Latest Threads

Top