469,358 Members | 1,566 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,358 developers. It's quick & easy.

Timeout to readline()/readlines()

Hi folks,
Sometimes, when I do an os.popen*(), the process executed by the
command hangs, and the script stops forever on the readline()/
readlines() calls. I found that I can use select, but I'm thinking...
if, after a sellect() call returns, the stdout (for example) has more
than one line? or if it has just some characters, no newline, and the
process just hangs?

I just want a readline(timeout) and readlines(timeout) like
functions. Do I need to create my owns or there're already
implemented?

Thanks.

Mar 19 '07 #1
1 4542
"Horta" <da**********@gmail.comwrote:
Sometimes, when I do an os.popen*(), the process executed by the
command hangs, and the script stops forever on the readline()/
readlines() calls. I found that I can use select, but I'm thinking...
if, after a sellect() call returns, the stdout (for example) has more
than one line? or if it has just some characters, no newline, and the
process just hangs?

I just want a readline(timeout) and readlines(timeout) like
functions. Do I need to create my owns or there're already
implemented?
you have to unblock the file and use try - except.
look at the fcntl module

- Hendrik

Mar 20 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Russell E. Owen | last post: by
reply views Thread by Guy | last post: by
12 posts views Thread by Mike Maxwell | last post: by
8 posts views Thread by Thierry Lam | last post: by
1 post views Thread by Christian Urbanczyk | last post: by
1 post views Thread by Joachim | last post: by
reply views Thread by Soeren Sonnenburg | last post: by
7 posts views Thread by Johny | last post: by
1 post views Thread by Marylou17 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.