[issue1175] .readline() has bug WRT nonblocking files

Sean Reifschneider report at bugs.python.org
Tue Sep 18 23:24:29 CEST 2007


Sean Reifschneider added the comment:

Arguably, you should be using "select" and "read" (instead of readline)
for this operation.  That's what I've done in the past when doing
something similar.  Specifically, I believe I have looped reading into a
buffer with read, and using select with a timeout (even a fraction of a
second can work) until the timeout triggers.  This way I don't block,
but I also don't run into problems with the system call returning an error.

I avoid using readline in this case because I don't expect it to work
well on the stdout of an interactive command.

You may also want to look at the pty module.

I guess I'd say this should probably go to the python mailing list for
further discussion.  Can you post a message there about it?

__________________________________
Tracker <report at bugs.python.org>
<http://bugs.python.org/issue1175>
__________________________________


More information about the Python-bugs-list mailing list