On 02/05/10 14:39, Ashok Prabhu wrote: > On Feb 5, 6:33 pm, Ashok Prabhu <ashokprab...@gmail.com> wrote: >> On Feb 5, 5:58 pm, Alain Ketterlin <al...@dpt-info.u-strasbg.fr> >> wrote: >> >> >> >>> Ashok Prabhu <ashokprab...@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. > > Oops i missed the braces. But still no output. > > >>>> p1=Popen(['/usr/sunvts/bin/64/vtsk','-d'],stdout=PIPE) >>>> while 1: > ... a=p1.stdout.readline() > ... print a > ...
I've tried #!/usr/bin/python import subprocess p1= subprocess.Popen(['/bin/ls','/LOCAL/'],stdout=subprocess.PIPE) for line in p1.stdout : print ">>>",line which works just fine. Are you sure, your /usr/sunvts/bin/64/vtsk writes a newline character (readline is waiting for that)? Helmut. -- Helmut Jarausch Lehrstuhl fuer Numerische Mathematik RWTH - Aachen University D 52056 Aachen, Germany -- http://mail.python.org/mailman/listinfo/python-list