Skip to content

.env file not working #9358

Closed
Closed

Description

@timkgh

Environment data

  • VS Code version: 1.41.1
  • Extension version (available under the Extensions sidebar): 2019.11.50794
  • OS and version: macOS 10.14.6
  • Python version (& distribution if applicable, e.g. Anaconda): 3.7.6
  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): virtualenv
  • Relevant/affected Python packages and their versions:
  • Jedi or Language Server? (i.e. what is "python.jediEnabled" set to; more info How to update the language server to the latest stable version #3977): Language Server ("python.jediEnabled": false)

Expected behaviour

Env vars set in .env file should be present in python and in terminal.

Actual behaviour

Env vars missing.

Steps to reproduce:

  1. Create an empty folder, brand new simple workspace
  2. Create a .env file in the workspace folder
  3. Set a variable FOO=bar in the .env file
  4. Run a simple envtest.py python file via Cmd+Shift+P: "Run python file in terminal"
import os
print(os.environ.get('FOO'))
  1. The printed value is None, the env var is not set
  2. The env var is also not present in the integrated VSCode terminal echo $FOO

FWIW, I also tried setting python.envFile in .vscode/settings.json to the absolute path of the .env file and it still does not work.

Activity

  1. added
    triage-neededNeeds assignment to the proper sub-team
    bugIssue identified by VS Code Team member as probable bug
    on Jan 2, 2020
  2. ghost removed
    triage-neededNeeds assignment to the proper sub-team
    on Jan 2, 2020
  3. karrtikr commented on Jan 2, 2020

    @karrtikr

    Closing as dup of #944
    Please upvote that issue to bump its priority.

  4. ghost removed on Jan 2, 2020
  5. locked as resolved and limited conversation to collaborators on Jan 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugIssue identified by VS Code Team member as probable bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions