I currently have a script being executed by a program that comes with its own Python interpreter included.
This version does not include libraries I require so I use an os.exec to execute a second script against a locally installed instance of 2.7.
However the second script, when executed manually, works perfectly and doesn’t have PYTHONPATH defined. If I log the output of PYTHONPATH when the wrapper is executed and when the second script is loaded they both have PYTHONPATH initialized to the original interpreters, which happens to also be a 2.6 instance.
This obviously has led me to believe I have some environmental variables being passed that I didn’t anticipate, furthermore on 2 other systems this setup works 100% as expected whilst on this one system this behavior is happening.
Is there a cleaner way I could create a wrapper to call the second script? If not how could I avoid this unnecessary passing of env variables.
There are many variants of the
os.exec*command:lvariants use*args,vvariants useargs.pvariants use the PATH environment variable to findfileevarients replace the environment. Non-evariants use the env ofcurrent process.
You could use one of the
evariants, such asos.execle, to control the environment variables passed to the new process.