Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Python (http://www.velocityreviews.com/forums/f43-python.html)
-   -   Re: read stdout/stderr without blocking (http://www.velocityreviews.com/forums/t349080-re-read-stdout-stderr-without-blocking.html)

Adriaan Renting 09-14-2005 08:09 AM

Re: read stdout/stderr without blocking
 
Please note that popen uses pipes, which are block devices, not character devices, so the writes will be done in blocks instead of characters/lines, (you can only read something _after_ the application at the other end of the pipe has done a flush or written 8192 bytes.

When reading from a pty like pexpect does, your read will not block until the stdio block buffer is filled.

Maybe using popen is your problem? The FAQ of Pexpect explains the problem very clearly.


>>>Jacek Pop*awski <jpopl@interia.pl> 09/13/05 4:36 pm >>>

|Grant Edwards wrote:
|>You're right. I must have been remembering the behavior of a
|>network socket. Apparently, you're supposed to read a single
|>byte and then call select() again. That seems pretty lame.
|
|I created another thread with single read(), it works, as long as I have
| only one PIPE (i.e. stderr is redirected into stdout).
|I wonder is it Python limitation or systems one (I need portable solution)?
--
http://mail.python.org/mailman/listinfo/python-list



All times are GMT. The time now is 08:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.