python subprocesses code example
Example 1: subprocess python
import subprocess
import sys
result = subprocess.run([sys.executable, "-c", "print('ocean')"])
Example 2: python subprocess exception handling
try:
subprocess.check_output(...)
except subprocess.CalledProcessError as e:
print(e.output)