How to run an EXE, with argument, capture output value

noydb jenn.duerr at gmail.com
Thu Nov 18 15:15:03 EST 2010


I will use 2.5.

I tried your suggestion, with this code

import subprocess
pig = subprocess.Popen(["C:\Halls\hallbig2.exe"],
stdin=subprocess.PIPE, stdout=subprocess.PIPE)
result = pig.communicate(input='C:\Halls\Input\Ea39j.txt')[-1] #I need
to capture the, what I think is the, last output
print result
print pig.returncode
>> None
>> 0

So the tuple is empty. ??  The exe executes fine and returns output in
th exe tool itself.  The python script seems to execute fine, no
errors, '...returned exit code 0'.  Any ideas/suggestions?



More information about the Python-list mailing list