I use an external library (OIIO with OCIO) which relies on env vars to resolve paths in its config.
When I set the env vars with os.environ and then use the library, it cannot resolve the paths; like it doesn't see the env vars.
I can make it work when:
- I set the env vars in the command line and calling the python script with
python foo_bar.py - or I set the env vars with
os.environand usesubprocess.Popen()to call another python which uses the library - or it also works with PyCharm when I set the env vars in the run configuration settings. PyCharm sets the env vars with
os.environthen calls my .py withrunfile('path_to.py', args=[...], wdir='path_to_working_dir')('Cause I use "Run with Python Console")
So it seems it only works when I start a new process after setting the env vars. What is that extra step that starting these new processes does and using os.environ doesn't do? Can I fake / force that extra step?
Is there a way I can avoid using a new process? (I'd like to do so based on the 2nd answer in this thread).