We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use the following sample code to load the .env file without loading the env file with additionally installed third-party modules.
.env
import os print(os.getenv("name"))
File structure
py03 ├─ .env ├─ .vscode │ ├─ launch.json │ └─ settings.json └─ demo02.py
.env file
name=VSCODE
The content of settings.json file:
{ "python.envFile": "${workspaceFolder}/.env" }
Results using Run Python FIle
Run Python FIle
Add envFile configuration in launch.json
envFile
{ "version": "0.2.0", "configurations": [ { "name": "Python: Current File", "type": "python", "request": "launch", "program": "${file}", "console": "integratedTerminal", "justMyCode": true, "envFile": "${workspaceFolder}/.env" } ] }
Use the triangle button to debug the script in the Run and Debug panel, or use Ctrl+F5 can get results
Ctrl+F5
Why does the same code work under debug, but run doesn't work?
The text was updated successfully, but these errors were encountered:
Closing as dup of #944
Sorry, something went wrong.
Btw this issue should be solved with #11039, the fix should already be out if you want to try it:
"python.experiments.optInto": ["pythonTerminalEnvVarActivation"]
(<env_name>)
karrtikr
No branches or pull requests
Use the following sample code to load the
.env
file without loading the env file with additionally installed third-party modules.File structure
.env
fileThe content of settings.json file:
Results using
Run Python FIle
Add
envFile
configuration in launch.jsonUse the triangle button to debug the script in the Run and Debug panel, or use
Ctrl+F5
can get resultsWhy does the same code work under debug, but run doesn't work?
The text was updated successfully, but these errors were encountered: