Re: How to catch a line with Popen

2011-05-31 Thread TheSaint
Chris Torek wrote: Since it is a generator that only requests another line when called, it should be fine Is it, then, that until the new itaration, the callee is on pause? -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: How to catch a line with Popen

2011-05-30 Thread TheSaint
Chris Torek wrote: In at least some versions of Python 2 I'm with P3k :P. However thank you for your guidelines. Last my attempt was to use a *for* p.wait() , as mentioned earlier That looks good enough. I noted some little delay for the first lines, mostly sure Popen assign some buffer even

Re: How to catch a line with Popen

2011-05-30 Thread Chris Torek
Chris Torek wrote: In at least some versions of Python 2 [the file-type object iterators behave badly with pipes] (This may still be true in Python 3, I just have no experience with Py3k. At least some version of Python 2 means the ones I have access to, and have tried. :-) ) In article

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
Tim Roberts wrote: Are you specifying a buffer size in the Popen command? If not, then the Python side of things is unbuffered The buffer is as per default. The program reports one line around 1/2 second time. I think I'll look into the option as Nobody states: p =

Re: How to catch a line with Popen

2011-05-29 Thread Chris Rebert
On Sun, May 29, 2011 at 3:02 AM, TheSaint nob...@nowhere.net.no wrote: Tim Roberts wrote: Are you specifying a buffer size in the Popen command?  If not, then the Python side of things is unbuffered The buffer is as per default. The program reports one line around 1/2 second time. I think

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
Chris Rebert wrote: What do you mean by on-the-fly in this context I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. Imaging something like p= Popen(['ping','-c40','www.google.com'], stdout=PIPE) for line in p.stdout:

Re: How to catch a line with Popen

2011-05-29 Thread TheSaint
TheSaint wrote: I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. I think some info is also here: http://alexandredeverteuil.blogspot.com/ -- goto /dev/null -- http://mail.python.org/mailman/listinfo/python-list

Re: How to catch a line with Popen

2011-05-29 Thread Chris Torek
In article irtj2o$h0m$1...@speranza.aioe.org TheSaint nob...@nowhere.net.no wrote: Chris Rebert wrote: I just suppose to elaborate the latest line, as soon it's written on the pipe, and print some result on the screen. Imaging something like p= Popen(['ping','-c40','www.google.com'],

How to catch a line with Popen

2011-05-28 Thread TheSaint
Hello. I'm looking into subprocess.Popen docs. I've launch the program with its arguments and that's smooth. I'm expecting to read the output by *comunicate()* at every line that prgram may blow during the process, but the output is given only when the child process is ended. I'd like to

Re: How to catch a line with Popen

2011-05-28 Thread Nobody
On Sun, 29 May 2011 00:01:56 +0800, TheSaint wrote: I'm looking into subprocess.Popen docs. I've launch the program with its arguments and that's smooth. I'm expecting to read the output by *comunicate()* at every line that prgram may blow during the process, but the output is given only when

Re: How to catch a line with Popen

2011-05-28 Thread Tim Roberts
TheSaint nob...@nowhere.net.no wrote: I'm looking into subprocess.Popen docs. I've launch the program with its arguments and that's smooth. I'm expecting to read the output by *comunicate()* at every line that prgram may blow during the process, but the output is given only when the child

Re: How to catch a line with Popen

2011-05-28 Thread Dan Stromberg
On Sat, May 28, 2011 at 4:32 PM, Tim Roberts t...@probo.com wrote: TheSaint nob...@nowhere.net.no wrote: I'm looking into subprocess.Popen docs. I've launch the program with its arguments and that's smooth. I'm expecting to read the output by *comunicate()* at every line that prgram may