Python's subprocess.Popen() and source Python's subprocess.Popen() and source bash bash

Python's subprocess.Popen() and source


source uses $PATH to find what you pass to it, if you don't specify a directory. Try source ./houdini_setup.


You can use strace to help diagnose problems like this. In this case running it with the -ff flag to follow subprocess would have revealed that your code was looking for "houdini_setup" in the wrong place:

stat64("/usr/local/bin/houdini_setup", 0xbf989e60) = -1 ENOENT (No such file or directory)stat64("/usr/bin/houdini_setup", 0xbf989e60) = -1 ENOENT (No such file or directory)stat64("/bin/houdini_setup", 0xbf989e60) = -1 ENOENT (No such file or directory)

That could have led you to check the documentation for the source builtin.


Maybe you can just use bash itself to do the job, if it's available on your system:

os.popen("/bin/bash -l -c 'source $HOME/.yourfiletobesourced'")