env not accessing error

I’m running into an issue while working in Cursor (the AI-powered code editor). Even though I’ve installed the dotenv library using pip install python-dotenv, my .env file is not being accessed or loaded properly when I run my Python scripts.

I’ve double-checked that:

  • The .env file is in the root directory of the project
  • I’m calling load_dotenv() at the beginning of my script
  • The variables are correctly defined (e.g., API_KEY=your_api_key)

Despite this, environment variables still return None when accessed via os.getenv().

Has anyone else experienced this in Cursor? Are there any specific settings or workarounds needed to get environment variables working correctly in this editor?

Any help or insights would be appreciated!

hi, you can check to see if global ignore is set in the settings, the default is to ignore .env