How do I execute a command from within python and wait on that command?

Matt Nordhoff mnordhoff at
Fri Feb 15 18:59:45 CET 2008

Rafael Sachetto wrote:
> os.system(command)
> or
> proc = popen2.Popen3(command)
> proc.wait()

I don't know about "cleanly terminat[ing] the command shell", but you
should use the subprocess module now, not any of the other functions
scattered around.

More information about the Python-list mailing list