How to read stdout from subprocess as it is being produced

anthony.tolle at anthony.tolle at
Fri Dec 19 15:53:46 CET 2008

On Dec 19, 9:34 am, Alex <alex.pul... at> wrote:
> Hi,
> I have a Pyhon GUI application that launches subprocess.
> I would like to read the subprocess' stdout as it is being produced
> (show it in GUI), without hanging the GUI.
> I guess threading will solve the no-hanging issue, but as far as I
> searched for now, I've only seen how to read the stdout after
> subprocess is finished.
> Thanks!

If I'm interpreting your needs correctly, then you may find this
module helpful:

I've used it successfully in the past when I wanted to use native
python code (no C extensions necessary) for asynchronous reading from
a child process.

I'm not sure if later versions of Python (2.6, 3.0) support this in
the standard library.  I haven't researched it.

More information about the Python-list mailing list