Help need with subprocess communicate

Nicola Musatti nicola.musatti at gmail.com
Fri Jun 6 04:40:10 EDT 2008


On Jun 4, 9:56 am, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
> On Tue, 3 Jun 2008 23:48:38 -0700 (PDT), rdab... at gmail.com declaimed the
> following in comp.lang.python:
>
> > Is there way to configure the stdout buffer size so that it flushes
> > earlier..
> > Is there a way to make above mentioned piece code working?
>
>         I believe there is a command line argument that will set Python into
> an unbuffered mode... BUT, unless the spawned process/program has some
> similar option, you have no control over its output.

Which is why the Cookbook recipe I pointed to in my other message
appears to be a superior alternative. Its author works around this
problem by subclassing Popen to use non blocking I/O.

I used it to drive ClearCase's cleartool interactive tool and it works
very well. The only problem I encountered is that it doesn't mix well
with framework that have their own event loop (wxPython in my case),
but you can't really expect that to work.

Cheers,
Nicola Musatti



More information about the Python-list mailing list