env file not loaded if specified in launch.json and python.envFile
See original GitHub issueEnvironment data
- VS Code version: 1.38.0
- Extension version (available under the Extensions sidebar): 2019.9.34474
- OS and version: MAC OS Mojave - 10.14.6
- Python version (& distribution if applicable, e.g. Anaconda): Pyhton 3.7.2 - 64 bit
- Type of virtual environment used (N/A | venv | virtualenv | conda | …): N/A
- Relevant/affected Python packages and their versions: XXX
- Jedi or Language Server? (i.e. what is
"python.jediEnabled"
set to; more info #3977): Language Server
Issue description
In the latest build, when debugging a python file using integrated terminal, the contents of “.env” file are not being loaded. This issue is not seen in 2019.8.0. I downgraded to verify that this is a regression issue. Content of launch.json file
{
"name": "Python: Terminal (integrated)",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"envFile": "${workspaceRoot}/.env"
},
Contents of .env file
PYTHONPATH=/opt/library/python:/opt/lib/PythonApi
TCLLIBPATH="/opt/library /Library/Tcl/teapot/package/macosx10.5-i386-x86_64/lib"
Issue Analytics
- State:
- Created 4 years ago
- Reactions:2
- Comments:13
Top Results From Across the Web
VS Code "python.envFile" does not seem to work with "python ...
i was facing issue of module not found in vscode then i wrote the ... in VS Code settings files, it will not...
Read more >Using Python environments in VS Code
All env variables defined in the launch.json file will override variables contained in the .env file, specified by the python.envFile setting (user or...
Read more >How to use a .env file to load environment variables in a dev ...
Loading environment variables using a . env file when working with Remote - Containers or GitHub Codespaces. Check out the docs for more...
Read more >How to Set up Environment Variables in "launch.json ...
Nevertheless, as I started debugging, the debugging tool of vscode prepared forever and never entered the real debugging session. How should I ...
Read more >Run (not debug) python using the .env file : r/vscode - Reddit
Is there a way to run (not debug) a program using the .env file? When I debug, I create a bunch of environment...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I have submitted a PR to resolve this issue.
So if
envFile
in the launch configuration is no longer supported, that means there is no easy way to switch between different env-files for different launch configurations anymore? That feature was very helpful, and it’s even nicely documented here: https://code.visualstudio.com/docs/python/environments#_environment-variable-definitions-file :Now you have to go into settings and modify
python.envFile
each time when you want to run a launch config with a different env-file?I’m aware of the
env
option, but that’s not really a good alternative, because it would mean duplicating the values from the env-files.