Question

I'm trying to make a Python script run another program from its own path.

I've got the execution of the other program working using os.system, but the program will crash because it cannot find its resources (wrong path, I assume). I tried adding the folder harboring the executable to the path, but that didn't help.

Was it helpful?

Solution

You can change the current directory of your script with os.chdir(). You can also set environment variables with os.environ

OTHER TIPS

Use the subprocess module, and use the cwd argument to set the child's working directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top