I have been working on this particular assignment and ran into one issue. I'm fairly new to python and needed a quick fix. When this .exe file runs it prints a screen full of information and I want to print a particular line out to the screen here 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
cmd = ' -a ' + str(a) + ' -b ' + str(b) works fine but it's the last one that doesn't. I do understand that you have to define something before you use it later on (in the example giving me the error that Output isn't defined. But when I cut and paste:
outputstring = process.communicate()[0]
outputlist = outputstring.splitlines()
Output = outputlist[5]
before the cmd statement it tells me the process isn't defined of course and it's just a dance over and over moving things before the other and I can't seem to figure it out. str(Output) should be what is printed on line 6 when the .exe is ran.
Thanks for all the help. I hope I was descriptive enough in my quesiton. Showing what you would do would be helpful also.