I have some instrument which requires environment variable which I want to set automatically from python code. So I tried several ways to make it happen, but none of them were successful.
Here are some examples:
#call it from python
Is it possible to set(export) environment variable using python, i.e
without directly exporting it to shell?
As long as you start the "instrument" (a script I supposed) from the very same process it should work:
In : os.putenv("VARIABLE", "123") In : os.system("echo $VARIABLE") 123
You can't change an environment variable of a different process or a parent process.