Created
April 4, 2013 08:26
-
-
Save glennzw/5308728 to your computer and use it in GitHub Desktop.
Python - calling external programs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if you want the process's exitcode, subprocess.call() returns that. If you want to execute something and raise an exception if it fails, subprocess.check_call() does that. If you want something more complicated, including a conversation with the process you're starting or simply not waiting for the process to end, subprocess.Popen is what you want. | |
import subprocess | |
r=subprocess.check_call(["ls"]) | |
r=subprocess.call(["ls"]) | |
r = subprocess.Popen(["ls"]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment