Peter Otten wrote:
Ian Simcock wrote:
Greetings all.
I'm using Python 2.7 under Windows and am trying to run a command line
program and process the programs output as it is running. A number of
web searches have indicated that the following code would work.
import subprocess
p = subprocess.P
random...@fastmail.us wrote:
> On Fri, Aug 23, 2013, at 7:14, Peter Otten wrote:
>> The following works on my linux system:
>>
>> instream = iter(p.stdout.readline, "")
>>
>> for line in instream:
>> print line.rstrip()
>>
>> I don't have Windows available to test, but if it works t
On Fri, Aug 23, 2013, at 7:14, Peter Otten wrote:
> The following works on my linux system:
>
> instream = iter(p.stdout.readline, "")
>
> for line in instream:
> print line.rstrip()
>
> I don't have Windows available to test, but if it works there, too, the
> problem is the interna
On 2013-08-22, Chris Angelico wrote:
> On Fri, Aug 23, 2013 at 1:26 AM, Ian Simcock
> wrote:
>> Chris Angelico wrote:
>>>
>>> Is the program actually producing output progressively? I just tried
>>> your exact code with "dir /ad /s /b" and it worked fine, producing
>>> output while the dir was sti
Peter Otten wrote:
The following works on my linux system:
import subprocess
p = subprocess.Popen(
["ping", "google.com"],
stdout=subprocess.PIPE)
instream = iter(p.stdout.readline, "")
for line in instream:
print line.rstrip()
I don't have Windows available to test, but if i
Ian Simcock wrote:
> Greetings all.
>
> I'm using Python 2.7 under Windows and am trying to run a command line
> program and process the programs output as it is running. A number of
> web searches have indicated that the following code would work.
>
> import subprocess
>
> p = subprocess.Popen
> >> I'm using Python 2.7 under Windows and am trying to run a command line
> >> program and process the programs output as it is running. A number of
> >> web searches have indicated that the following code would work.
> >>
> >> import subprocess
> >>
> >> p = subprocess.Popen("D:\Python\Python27\
Op 23-08-13 11:53, Antoon Pardon schreef:
> Op 22-08-13 07:51, Ian Simcock schreef:
>> Greetings all.
>>
>> I'm using Python 2.7 under Windows and am trying to run a command line
>> program and process the programs output as it is running. A number of
>> web searches have indicated that the followi
Op 22-08-13 07:51, Ian Simcock schreef:
> Greetings all.
>
> I'm using Python 2.7 under Windows and am trying to run a command line
> program and process the programs output as it is running. A number of
> web searches have indicated that the following code would work.
>
> import subprocess
>
>
Ian Simcock wrote:
When I use this code I can see that the Popen works, any code between
the Popen and the for will run straight away, but as soon as it gets to
the for and tries to read p.stdout the code blocks until the command
line program completes, then all of the lines are returned.
Does
Rob Wolfe wrote:
Ian Simcock writes:
When file object is used in a for loop it works like an iterator
and then it uses a hidden read-ahead buffer.
It might cause this kind of blocking.
You can read more details here (description of method ``next``):
http://docs.python.org/lib/bltin-file-objects
Chris Angelico wrote:
On Fri, Aug 23, 2013 at 1:26 AM, Ian Simcock
wrote:
Chris Angelico wrote:
A lot of programs, when their output is not going to the console, will
buffer output. It's more efficient for many purposes. With Unix
utilities, there's often a parameter like --pipe or --unbuff
Ian Simcock writes:
> Greetings all.
>
> I'm using Python 2.7 under Windows and am trying to run a command line
> program and process the programs output as it is running. A number of
> web searches have indicated that the following code would work.
>
> import subprocess
>
> p = subprocess.Popen(
On Fri, Aug 23, 2013 at 1:26 AM, Ian Simcock
wrote:
> Chris Angelico wrote:
>>
>> Is the program actually producing output progressively? I just tried
>> your exact code with "dir /ad /s /b" and it worked fine, producing
>> output while the dir was still spinning (obviously setting shell=True
>> t
Chris Angelico wrote:
Is the program actually producing output progressively? I just tried
your exact code with "dir /ad /s /b" and it worked fine, producing
output while the dir was still spinning (obviously setting shell=True
to make that work, but I don't think that'll make a difference). It
m
On Thu, Aug 22, 2013 at 3:51 PM, Ian Simcock
wrote:
> When I use this code I can see that the Popen works, any code between the
> Popen and the for will run straight away, but as soon as it gets to the for
> and tries to read p.stdout the code blocks until the command line program
> completes, the
Greetings all.
I'm using Python 2.7 under Windows and am trying to run a command line
program and process the programs output as it is running. A number of
web searches have indicated that the following code would work.
import subprocess
p = subprocess.Popen("D:\Python\Python27\Scripts\pip.e
17 matches
Mail list logo