Problems with select

Robin Munn rmunn at
Tue Feb 26 12:01:30 EST 2002

On Tue, 26 Feb 2002 04:17:30 +0100, Alain Tesio <alain at> wrote:
>Hi, I can't manage to make select work, in both 1.52 and 2.1.2
>I just want to read stderr and stdout when executing a command
>with popen3, and I must use select, read() blocks when there is
>more than a fixed amount of data (4 KB I think)
>The problems is that select still gives something after the end
>of the file, or sometimes never returns anything at all.
>I create the pipes with :
>and use select like this:
>(the doc says : select(iwtd, owtd, ewtd[, timeout])
>I didn't put pipe_in as it's closed)

I don't think you've understood the documentation completely. The three
lists you pass to select() are lists of objects for input, output, and
"exceptional conditions" (which are things like out-of-band data in
TCP/IP sockets). Here, "input" and "output" means from the point of view
of your program: if you want to be informed when a pipe has data waiting
for you to read, you put it in the input list.

So what I think you should be doing is:[pipe_out, pipe_err], [], [], 1)

Hope this helps.

Robin Munn
rmunn at

More information about the Python-list mailing list