Hello and thank you in advance. This is really messing me up.
I’m using Pycharm in windows 11.
I’m creating an environment variable called APP_ID using $env:APP_ID = “12345”
When I run dir env: I can see it.
But running this simple script gives me none:
import os
print(os.environ.get(“APP_ID”))
But when I run the script from the terminal (python main.py) it gives me the key 12345.
If I change the script to print(os.environ) and run it it’s not there, but if I again run it from the terminal it’s there.
What the hell!!!
PedroSantos is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
1