When an exe file is run it prints out some stuff. I'm trying to run this on some numbers below and print out line 54 ( = blah ). It says process isn't defined and I'm really unsure how to fix this and get what I want printed to the screen. If anyone could post some code or ways to fix this thank you so very much!
for j in ('90','52.62263','26.5651','10.8123'):
if j == '90':
k = ('0',)
elif j == '52.62263':
k = ('0', '72', '144', '216', '288')
elif j == '26.5651':
k = (' 324', ' 36', ' 108', ' 180', ' 252')
else:
k = (' 288', ' 0', ' 72', ' 144', ' 216')
for b in k:
outputstring = process.communicate()[0]
outputlist = outputstring.splitlines()
blah = outputlist[53]
cmd = ' -j ' + str(j) + ' -b ' + str(b) + ' blah '
process = Popen(cmd, shell=True, stderr=STDOUT, stdout=PIPE)
print cmd
I am trying to print out for example:
-j 90 -az 0 (then what blah contains) blah is line 54. Line 54 prints out a lot of information. Words mostly. I want to print out what line 54 says to the screen right after
-j 90 -az 0
@ Robbie: line 39
blah = outputlist[53]
Indexerror: list index out of range
@ Robbie again. Thanks for your help and sorry for the trouble guys...
I even tried putting in outputlist[2] and it gives same error :/