Created
March 6, 2015 19:03
-
-
Save perbu/f492d25448bde3f6de12 to your computer and use it in GitHub Desktop.
subprocess is lame
This file contains 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
#!/usr/local/bin/python | |
import subprocess | |
output = "not set" | |
try: | |
output = subprocess.check_output(["ls", "/", "/foo"]) | |
print "success!" | |
print(output) | |
except subprocess.CalledProcessError: | |
print "fail!" | |
print output # will output "not set" | |
print "finished" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment