I have complex software that I cannot publish, and I do not have a concrete working example. I will try to explain the problem, maybe someone has come across this before.
In the Linux shell, I defined an environment variable:
> export MY_TEST_ENV=4711 > echo $MY_TEST_ENV > 4711
In complex code, I want to get this variable with
print os.getenv('MY_TEST_ENV')
which always returns None . If I create a test script to test this behavior, even with classes in different files, I always get the desired behavior, for example, os.getenv('MY_TEST_ENV') returns the correct value 4711 .
The code is launched using sudo .
Any ideas what could be the reason?
Alex
source share