How can I call an external program with a python script and retrieve the output and return code?
How can I call an external program with a python script and retrieve the output and return code?
Look at the subprocess module: a simple example follows...
from subprocess import Popen, PIPE
process = Popen(["ls", "-la", "."], stdout=PIPE)
(output, err) = process.communicate()
exit_code = process.wait()
Check out the subprocess module here: http://docs.python.org/library/subprocess.html#module-subprocess. It should get what you need done.