Here\'s the Python code to run an arbitrary command returning its stdout data, or raise an exception on non-zero exit codes:
stdout
proc = subprocess.P
if you are using python 2, give it a try
import subprocess32 try: output = subprocess32.check_output(command, shell=True, timeout=3) except subprocess32.TimeoutExpired as e: print e