An event call back is *exactly* the kind of thing that I&#39;m looking for. I hadn&#39;t seen these yet... I&#39;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">&lt;<a href="mailto:jtatum@gmail.com">jtatum@gmail.com</a>&gt;</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 &lt;<a href="mailto:glen@glenjarvis.com">glen@glenjarvis.com</a>&gt; wrote:<br>
&gt; I&#39;m sorry, I thought I was more clear with my test case. Obviously, I was<br>
&gt; not.<br>
&gt;<br>
&gt; The problem is this:<br>
&gt;     Python programs can call subprocesses. The python program can wait until<br>
&gt; the subprocess has finished and print the output captured. However, what we<br>
&gt; want is to print the output immediately as it is generated.<br>
&gt;     So, instead of waiting for the subprocess to finish, the python program<br>
&gt; could continue -- printing the results as given by the subprocess.  >From the<br>
&gt; way the test case is written, the communicate() method will wait until the<br>
&gt; subprocess is finished *before* it prints the results that were found.<br>
&gt; Thanks for asking for clarification. You weren&#39;t the only person asking, so<br>
&gt; obviously I wasn&#39;t clear enough in defining the problem.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; Glen<br>
&gt; On Sat, Oct 2, 2010 at 10:13 AM, Aahz &lt;<a href="mailto:aahz@pythoncraft.com">aahz@pythoncraft.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; On Sat, Oct 02, 2010, Glen Jarvis wrote:<br>
&gt;&gt; &gt;<br>
&gt;&gt; &gt; I&#39;ve now seen a common problem come up several times. And, I imagine<br>
&gt;&gt; &gt; there<br>
&gt;&gt; &gt; is a common solution to this problem that I don&#39;t know.<br>
&gt;&gt;<br>
&gt;&gt; Could you explain what the problem is?  I think it&#39;s related to buffering<br>
&gt;&gt; and pipes, but it&#39;s not clear from your post.<br>
&gt;&gt; --<br>
&gt;&gt; Aahz (<a href="mailto:aahz@pythoncraft.com">aahz@pythoncraft.com</a>)           &lt;*&gt;<br>
&gt;&gt; <a href="http://www.pythoncraft.com/" target="_blank">http://www.pythoncraft.com/</a><br>
&gt;&gt;<br>
&gt;&gt; &quot;If you think it&#39;s expensive to hire a professional to do the job, wait<br>
&gt;&gt; until you hire an amateur.&quot;  --Red Adair<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; Baypiggies mailing list<br>
&gt;&gt; <a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
&gt;&gt; To change your subscription options or unsubscribe:<br>
&gt;&gt; <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Whatever you can do or imagine, begin it;<br>
&gt; boldness has beauty, magic, and power in it.<br>
&gt;<br>
&gt; -- Goethe<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; Baypiggies mailing list<br>
&gt; <a href="mailto:Baypiggies@python.org">Baypiggies@python.org</a><br>
&gt; To change your subscription options or unsubscribe:<br>
&gt; <a href="http://mail.python.org/mailman/listinfo/baypiggies" target="_blank">http://mail.python.org/mailman/listinfo/baypiggies</a><br>
&gt;<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>