By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,965 Members | 1,450 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,965 IT Pros & Developers. It's quick & easy.

select.select() on windows

P: n/a
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

Oct 25 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a

you have to use non-block readining.

http://docs.python.org/lib/module-select.html:
A time-out value of zero specifies a poll and never blocks.

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

Thanks

--
Best regards,
Maksim Kasimov
mailto: ma************@gmail.com
Oct 26 '05 #2

P: n/a

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 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.

--
Ben Sizer

Oct 26 '05 #3

P: n/a
On Wed, 26 Oct 2005 11:29:17 +0300, Maksim Kasimov
<ma************@gmail.com> declaimed the following in comp.lang.python:

you have to use non-block readining.

http://docs.python.org/lib/module-select.html:
A time-out value of zero specifies a poll and never blocks.
Did you miss the subject line... "... on windows"? select() only
works with sockets on windows, not on regular file streams.
-- ================================================== ============ <
wl*****@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
wu******@dm.net | Bestiaria Support Staff <
================================================== ============ <
Home Page: <http://www.dm.net/~wulfraed/> <
Overflow Page: <http://wlfraed.home.netcom.com/> <

Oct 26 '05 #4

P: n/a

yes, i missed, sorry

Dennis Lee Bieber wrote:
On Wed, 26 Oct 2005 11:29:17 +0300, Maksim Kasimov
<ma************@gmail.com> declaimed the following in comp.lang.python:

you have to use non-block readining.

http://docs.python.org/lib/module-select.html:
A time-out value of zero specifies a poll and never blocks.


Did you miss the subject line... "... on windows"? select() only
works with sockets on windows, not on regular file streams.

--
Best regards,
Maksim Kasimov
mailto: ma************@gmail.com
Oct 27 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.