On 7/4/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote:
> Only when the program has executed and the output available, subprocess can
> read through PIPE's stdout it seems ( not at any other time).
> With killing, I loose the output.
I think you have to read the data from the process's stdout be
On Jul 4, 4:38 am, Phoe6 <[EMAIL PROTECTED]> wrote:
> Hi all,
> Consider this scenario, where in I need to use subprocess to execute a
> command like 'ping 127.0.0.1' which will have a continuous non-
> terminating output in Linux.
>
> # code
>
> >>>import subprocess
> >>>process = subprocess.Popen
On Jul 4, 12:29 pm, "O.R.Senthil Kumaran"
<[EMAIL PROTECTED]> wrote:
> * Jerry Hill <[EMAIL PROTECTED]> [2007-07-04 11:23:33]:
>
>
>
> > That's because you tied stdin to a pipe in your Popen call, but then
> > tried to read from stdout. Try this instead:
>
> My mistake. I had just 'typed' the co
> Only when the program has executed and the output available, subprocess can
> read through PIPE's stdout it seems ( not at any other time).
> With killing, I loose the output.
This is untrue.
>>> process.stdout.read() # Blocks until end of stream.
>>> process.stdout.read(1) # Reads one character
* Jerry Hill <[EMAIL PROTECTED]> [2007-07-04 11:23:33]:
>
> That's because you tied stdin to a pipe in your Popen call, but then
> tried to read from stdout. Try this instead:
My mistake. I had just 'typed' the command in the mail itself and forgot to
include the stdin, stdout, and stderr and
O.R.Senthil Kumaran wrote:
> * zacherates <[EMAIL PROTECTED]> [2007-07-04 12:09:03]:
>
>>> How should I handle these kind of commands (ping 127.0.0.1) with
>>> subprocess module. I am using subprocess, instead of os.system because
>>> at anypoint in time, I need access to stdout and stderr of exec
On 7/4/07, O.R.Senthil Kumaran <[EMAIL PROTECTED]> wrote:
> Yes, I am aware of the ping -c option. But again even that does not help.
> try
> process = subprocess.Popen('ping -c 10 127.0.0.1', stdin=subprocess.PIPE,
> shell=True)
> process.stdout.read() # This will hang again.
When I try that, it
* zacherates <[EMAIL PROTECTED]> [2007-07-04 12:09:03]:
> > How should I handle these kind of commands (ping 127.0.0.1) with
> > subprocess module. I am using subprocess, instead of os.system because
> > at anypoint in time, I need access to stdout and stderr of execution.
>
> Ping, for one, allo
> How should I handle these kind of commands (ping 127.0.0.1) with
> subprocess module. I am using subprocess, instead of os.system because
> at anypoint in time, I need access to stdout and stderr of execution.
Ping, for one, allows you to set an upper bound on how long it runs
(the -c option).
Hi all,
Consider this scenario, where in I need to use subprocess to execute a
command like 'ping 127.0.0.1' which will have a continuous non-
terminating output in Linux.
# code
>>>import subprocess
>>>process = subprocess.Popen('ping 127.0.0.1', shell=True,
>>>stdin=subprocess.PIPE, stdout=subp
10 matches
Mail list logo