I’m trying to read system variables in my python script but for some reason it doesn’t work in vscode.
I manually set the system variable MY_ENV_VAR
to test
.
Now, when running os.getenv('MY_ENV_VAR')
in the console, I get the expected result of 'test'
, but when doing the same thing in vscode, I get None
.
Both console and vscode use the exact same python interpreter.
After some digging, I found out that the in the console, os.environ
is slightly different compared to the one I get in vscode, one of the differences being my newly created variable.
How can I set a system variable such that I can read in from within vscode?