When these lines are executed in my Python script:
a = ['python', '-v']
finishedProcess = subprocess.run(a, stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=True)
both finishedProcess.stdout
and finishedProcess.stderr
are empty, and finishedProcess.returncode
is 0. As you can see, I am even combining both stderr and stdout into the stdout variable.
I can run the same command directly from the command line and get output.
I have been following the directions from this posting: Running shell command and capturing the output
What am I doing wrong here? My Python version is 3.7.6.