subprocess.call( shell=True, stdout=f) code example
Example: python subprocess exception handling
try:
subprocess.check_output(...)
except subprocess.CalledProcessError as e:
print(e.output)
try:
subprocess.check_output(...)
except subprocess.CalledProcessError as e:
print(e.output)