how to share stdout and in between subprocess code example
Example 1: python subprocess exception handling
try:
subprocess.check_output(...)
except subprocess.CalledProcessError as e:
print(e.output)
Example 2: python write subprocess stdout stderr to file
with open("stdout.txt","wb") as out, open("stderr.txt","wb") as err:
subprocess.Popen("ls",stdout=out,stderr=err)