When this .exe file is launched, it displays the full text, and I want to print a specific line on the screen, here in line "6":
cmd = ' -a ' + str(a) + ' -b ' + str(b) + str(Output)
process = Popen(cmd, shell=True, stderr=STDOUT, stdout=PIPE)
outputstring = process.communicate()[0]
outputlist = outputstring.splitlines()
Output = outputlist[5]
print cmd
This works great:
cmd = ' -a ' + str(a) + ' -b ' + str(b)
This does not work:
cmd = ' -a ' + str(a) + ' -b ' + str(b) + str(Output)
I get an Outputundefined error message . But when I cut and paste:
outputstring = process.communicate()[0]
outputlist = outputstring.splitlines()
Output = outputlist[5]
before the cmd expression, it tells me that the process is not defined. str(Output)should be what is printed on line 6 when running .exe.
Jimk
source
share