I'm playing around with subprocess.Popen
for shell commands as it seems it has more flexbility with regards to piping compared to subprocess.run
I'm starting off with some simple examples but I'm getting FileNotFoundError:
I was told that shell = True
is not necessary if I make the arguments as proper lists. However it doesn't seem to be working.
Here are my attempts:
import subprocess
p1 =subprocess.Popen(['dir'], stdout =subprocess.PIPE)
output = p1.communicate[0]
p = subprocess.Popen([ "dir", "c:\\Users"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
outputs = p.communicate()
Both are leading to FileNotFoundError