get text from rogramms runn by subprocess.Popen immediatetly

Aaron Brady castironpi at gmail.com
Fri Apr 17 12:22:01 EDT 2009


On Apr 16, 8:02 am, Rüdiger Ranft <_r... at web.de> wrote:
> Diez B. Roggisch schrieb:
>
> > Rüdiger Ranft schrieb:
> >> Hi all,
>
> >> I need to call some programms and catch their stdout and stderr streams.
> >> While the Popen class from subprocess handles the call, I get the
> >> results of the programm not until the programm finishes. Since the
> >> output of the programm is used to generate a progress indicator, I need
> >> a way to acces the values written to stdout/stderr as fast as possible.
snip

FWIR from what I recall, you have to create and open read and write
file descriptors using the 'msvcrt.get_osfhandle' function, and pass
them to the subprocess on the command line.  Or you can pass the
handles.  Then you get a communication channel that is not STDIN.

I have no idea why the designers did this.  I've submitted a patch,
and received 0 attention on it.



More information about the Python-list mailing list