An event call back is *exactly* the kind of thing that I'm looking for. I hadn't seen these yet... I'll review the PEPs now.<div><br></div><div>Thank you!</div><div><br></div><div><br></div><div>Glen<br><br><div class="gmail_quote">
On Sat, Oct 2, 2010 at 10:23 AM, James Tatum <span dir="ltr"><<a href="mailto:jtatum@gmail.com">jtatum@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Google turns up a number of requests for this functionality, and a draft PEP[0].<br>
<br>
Did you see this module[1]? It adds an event callback for subprocess output.<br>
<br>
[0] <a href="http://www.python.org/dev/peps/pep-3145/" target="_blank">http://www.python.org/dev/peps/pep-3145/</a><br>
[1] <a href="http://code.activestate.com/recipes/576957-asynchronous-subprocess-using-asyncore/" target="_blank">http://code.activestate.com/recipes/576957-asynchronous-subprocess-using-asyncore/</a><br>
<div><div></div><div class="h5"><br>
On Sat, Oct 2, 2010 at 10:17 AM, Glen Jarvis <<a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a>> wrote:<br>
> I'm sorry, I thought I was more clear with my test case. Obviously, I was<br>
> not.<br>
><br>
> The problem is this:<br>
> Python programs can call subprocesses. The python program can wait until<br>
> the subprocess has finished and print the output captured. However, what we<br>
> want is to print the output immediately as it is generated.<br>
> So, instead of waiting for the subprocess to finish, the python program<br>
> could continue -- printing the results as given by the subprocess. >From the<br>
> way the test case is written, the communicate() method will wait until the<br>
> subprocess is finished *before* it prints the results that were found.<br>
> Thanks for asking for clarification. You weren't the only person asking, so<br>
> obviously I wasn't clear enough in defining the problem.<br>
><br>
> Cheers,<br>
><br>
> Glen<br>
> On Sat, Oct 2, 2010 at 10:13 AM, Aahz <<a href="mailto:aahz@pythoncraft.com">aahz@pythoncraft.com</a>> wrote:<br>
>><br>
>> On Sat, Oct 02, 2010, Glen Jarvis wrote:<br>
>> ><br>
>> > I've now seen a common problem come up several times. And, I imagine<br>
>> > there<br>
>> > is a common solution to this problem that I don't know.<br>
>><br>
>> Could you explain what the problem is? I think it's related to buffering<br>
>> and pipes, but it's not clear from your post.<br>
>> --<br>
>> Aahz (<a href="mailto:aahz@pythoncraft.com">aahz@pythoncraft.com</a>) <*><br>
>> <a href="http://www.pythoncraft.com/" target="_blank">http://www.pythoncraft.com/</a><br>
>><br>
>> "If you think it's expensive to hire a professional to do the job, wait<br>
>> until you hire an amateur." --Red Adair<br>
>> _______________________________________________<br>
>> Baypiggies mailing list<br>
>> <a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
>> To change your subscription options or unsubscribe:<br>
>> <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br>
><br>
><br>
><br>
> --<br>
> Whatever you can do or imagine, begin it;<br>
> boldness has beauty, magic, and power in it.<br>
><br>
> -- Goethe<br>
><br>
> _______________________________________________<br>
> Baypiggies mailing list<br>
> <a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
> To change your subscription options or unsubscribe:<br>
> <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br>
><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>Whatever you can do or imagine, begin it;<br>boldness has beauty, magic, and power in it.<br><br>-- Goethe <br>
</div>