[Baypiggies] Subprocess: Common problem/common pattern

Glen Jarvis glen at glenjarvis.com
Sat Oct 2 19:17:37 CEST 2010

I'm sorry, I thought I was more clear with my test case. Obviously, I was

The problem is this:

    Python programs can call subprocesses. The python program can wait until
the subprocess has finished and print the output captured. However, what we
want is to print the output immediately as it is generated.

    So, instead of waiting for the subprocess to finish, the python program
could continue -- printing the results as given by the subprocess.  From the
way the test case is written, the communicate() method will wait until the
subprocess is finished *before* it prints the results that were found.

Thanks for asking for clarification. You weren't the only person asking, so
obviously I wasn't clear enough in defining the problem.



On Sat, Oct 2, 2010 at 10:13 AM, Aahz <aahz at pythoncraft.com> wrote:

> On Sat, Oct 02, 2010, Glen Jarvis wrote:
> >
> > I've now seen a common problem come up several times. And, I imagine
> there
> > is a common solution to this problem that I don't know.
> Could you explain what the problem is?  I think it's related to buffering
> and pipes, but it's not clear from your post.
> --
> Aahz (aahz at pythoncraft.com)           <*>
> http://www.pythoncraft.com/
> "If you think it's expensive to hire a professional to do the job, wait
> until you hire an amateur."  --Red Adair
> _______________________________________________
> Baypiggies mailing list
> Baypiggies at python.org
> To change your subscription options or unsubscribe:
> http://mail.python.org/mailman/listinfo/baypiggies

Whatever you can do or imagine, begin it;
boldness has beauty, magic, and power in it.

-- Goethe
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/baypiggies/attachments/20101002/02e7508c/attachment.html>

More information about the Baypiggies mailing list