subprocess.popen question

Eric_Dexter at msn.com Eric_Dexter at msn.com
Wed Jun 20 11:27:47 EDT 2007


I am trying to modify a programming example and I am coming up with
two problems...  first is that I can't seem to pass along the
arguments to the external command (I have been able to do that with
the old module and cmd is the command I wish to try) all the output
seems to be returned as one line (at least when I run the program in
spe).

import subprocess
from os import system
cmd = """gawk -f altertime.awk -v time_offset=4 -v
outfile="testdat.sco" "i1.sco" """
#subprocess.Popen.
last_line = subprocess.Popen(['gawk.exe'],
stdout=subprocess.PIPE).communicate()[0]
xx = 0
for line in last_line:
    xx = xx + 1
    if xx < 2:
      print line
    print str(xx)




More information about the Python-list mailing list