I'm running a script to feed an exe file a statement like below:
for j in ('90.','52.62263.','26.5651.','10.8123.'):
if j == '90.':
z = ('0.')
elif j == '52.62263.':
z = ('0.', '72.', '144.', '216.', '288.')
elif j == '26.5651':
z = ('324.', '36.', '108.', '180.', '252.')
else:
z = ('288.', '0.', '72.', '144.', '216.')
for k in z:
exepath = os.path.join('\Program Files' , 'BRL-CAD' , 'bin' , 'rtarea.exe')
exepath = '"' + os.path.normpath(exepath) + '"'
cmd = exepath + '-j' + str(el) + '-k' + str(z)
process=Popen('echo ' + cmd, shell=True, stderr=STDOUT )
print process
I'm using the command prompt and when I run the exe with these numbers there are times when It doesn't seem to be in order. Like sometimes it will print out 3 statements of the 52.62263 but then before they all are printed it will print out a single 26.5651 and then go back to 52.62263. It's not just those numbers that act like this. Different runs it may be different numbers (A 52.62263 between "two" 90 statements) . All in all, I want it to print it in order top to bottom. Any suggestions and using my code any helpful solutions? thanks!
z = ('0.') is not a tuple, therefore your for k in z loop will iterate over the characters "0" and ".". Add a comma to tell python you want it to be a tuple:
z = ('0.',)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With