Repost: Read a running process output

Ashok Prabhu ashokprabhuv at gmail.com
Fri Feb 5 08:33:00 EST 2010


On Feb 5, 5:58 pm, Alain Ketterlin <al... at dpt-info.u-strasbg.fr>
wrote:
> Ashok Prabhu <ashokprab... at gmail.com> writes:
> >> > p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE,shell=True)
>
> >> Use Popen(['/usr/...','-d'],stdout=PIPE), i.e., no shell.
>
> >> -- Alain.
> > Thanks for the response. However it throws an error. Please find
> > below.
>
> >>>> from subprocess import *
> >>>> p1=Popen('/usr/sunvts/bin/64/vtsk -d',stdout=PIPE)
>
> You forgot to change the monolithic command into a list of words. Since
> you don't use the shell anymore you have to give Popen a pre-parsed
> command line.
>
> -- Alain.

Here is the error again

>>> p1=Popen('/usr/sunvts/bin/64/vtsk','-d',stdout=PIPE)
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.4/subprocess.py", line 494, in __init__
    raise TypeError("bufsize must be an integer")
TypeError: bufsize must be an integer


~Ashok.



More information about the Python-list mailing list