Skip to content Skip to sidebar Skip to footer

Subprocess.popen Tries To Write To Nonexistent Pipe

Why doesn't the following work? import subprocess process = subprocess.Popen('cmd.exe', shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=None) The output I get

Solution 1:

I'm running windows 10 and have the same problem. The error goes away for me if I set stdout and stderr to the same value. Try setting them both to subprocess.PIPE instead of just stdout.

Solution 2:

Try:

import subprocess
subprocess.run(["echo", "Hello, world!"], shell=True)

This uses the default stdout and stderr, instead of creating a PIPE.

Post a Comment for "Subprocess.popen Tries To Write To Nonexistent Pipe"