Repost: Read a running process output

Alain Ketterlin alain at dpt-info.u-strasbg.fr
Fri Feb 5 13:58:27 CET 2010


Ashok Prabhu <ashokprabhuv 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.



More information about the Python-list mailing list