I'm trying to access environment variable which is exported in ~/.bashrc file as below.
export ENV=local
and did source ~/.bashrc
. I can see the value local when I hit echo $ENV
in terminal.
But in my python project (which is attached to a specific virtualenv in Pycharm) , when I try to do os.environ['ENV']
and run the script by rigt-clicking it and Run, it is throwing KeyError.
I can't see the ENV
in the output when i try to do os.environ
.
What could be the issue? I guess the virtualenv should not cause any issue. Is it true?
OS: Ubuntu 18.04
Python: 3.7.4