Filenotfounderror: [winerror 2] The System Can't Find The Specified File
I'm currently learning how to use the module subprocess and I just started with my new book. Instantly, I got an error message which I don't understand. Traceback (most recent call
Solution 1:
echo
is not a program that can be executed but it’s a shell command available in the Windows command line interpreter cmd.exe
.
In order to execute shell commands, you need to pass shell=True
to Popen
:
proc = subprocess.Popen(['echo', 'Hello there'], stdout=subprocess.PIPE, shell=True)
# ^^^^^^^^^^
Post a Comment for "Filenotfounderror: [winerror 2] The System Can't Find The Specified File"