I'm trying to run console commands via subprocess.Popen, and whenever I run it I get the windows "File not found" error, even when running the echo command. I am also using Popen inside a thread made with the thread module. Is that the problem?
+1
A:
echo
is not an executable, it's an internal command inside cmd.exe
. If you want to use Popen with internal commands, add a keyword parameter shell=True
grep
2010-08-12 23:49:12
I put in'"D:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe"'and I still get errors, it doesn't work with either shell=True or shell=FalseWhy?
Gabriele Cirulli
2010-08-12 23:54:44
+1
A:
Instead ofD:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe
, useD:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe
This eliminates any complications with backslashes inside quotes.
wallyk
2010-08-12 23:58:22
Another major source of the problem is whitespace inside the path. It is much more robust to use a list of parameters instead of a string. Try to do something like Popen(["D:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe", "param1", "param2"])
grep
2010-08-13 19:58:09