2

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?

2 Answers 2

5

Instead of
D:\Program Files\Steam\steamapps\terabytest\sourcesdk\bin\orangebox\bin\vbsp.exe, use
D:/Program Files/Steam/steamapps/terabytest/sourcesdk/bin/orangebox/bin/vbsp.exe

This eliminates any complications with backslashes inside quotes.

Sign up to request clarification or add additional context in comments.

1 Comment

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"])
3

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

2 Comments

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=False Why?
try escaping the backslashes (with another backslash)

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.