Skip to content
New issue

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

Variable substitution not working in environment variable definitions file when debugging #523

Open
martinResearch opened this issue Dec 11, 2020 · 5 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster needs PR Ready to be worked on

Comments

@martinResearch
Copy link

martinResearch commented Dec 11, 2020

Environment data

  • VS Code version: 1.52.0

  • Extension version (available under the Extensions sidebar): v2020.11.371526539

  • OS and version: Windows 10 Enterprise 20H2

  • Python version (& distribution if applicable, e.g. Anaconda): Python 3.7.9 (tags/v3.7.9:13c94747c7, Aug 17 2020, 18:58:18) [MSC v.1900 64 bit (AMD64)] on win32

  • Type of virtual environment used (N/A | venv | virtualenv | conda | ...): N/A

Expected behaviour

Should print the content of the PATH environment variable

Actual behaviour

the string "${env:PATH};" get printed

Steps to reproduce:

Steps to Reproduce:

create these files

d:\repos\bug_vscode\test.py:

import os
print(os.environ["PATH"])

d:\repos\bug_vscode.vscode.env

PATH=${env:PATH};

d:\repos\bug_vscode.vscode\launch.json

{
  "version": "0.2.0",
  "configurations": [

    {
      "name": "Current File",
      "type": "python",
      "envFile": "${workspaceFolder}/.vscode/.env",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal"
    }
  ]
}

launch with the debug configuration from the GUI
This produces these prints in the terminal:

${env:PATH};

while, according to the documentation here I would expect ${env:PATH} to be replaced by the content of the environment variable

Documented the issue here microsoft/vscode#112142 but got closed assuming it was a problem with the extension

@martinResearch martinResearch added triage-needed Needs assignment to the proper sub-team bug Issue identified by VS Code Team member as probable bug labels Dec 11, 2020
@ericsnowcurrently
Copy link
Member

@martinResearch, thanks for letting us know about this. Currently when you provide the "envFile" setting to the debugger, the extension only applies to that .env file the env vars defined in the "env" setting. Process-defined and other extension-defined env vars are not used. We'll check on what can be done about that and get back to you.

@int19h

@ericsnowcurrently
Copy link
Member

See: src/client/debugger/extension/configuration/resolvers/helper.ts

@mlisovyi
Copy link

mlisovyi commented Dec 17, 2020

For me it seems to actually work, if i skip env: portion, i.e. (assuming Windows like in the OP)

PYTHONPATH=${PYTHONPATH}

@kimadeline kimadeline removed their assignment Mar 24, 2021
@kimadeline
Copy link

kimadeline commented Mar 24, 2021

Still happening when using 2021.4.681399556-dev.

@eleanorjboyd
Copy link
Member

Hi! Since it has been a year or so since this was last updated I wanted to check in to see if this issue still persists. Let me know if so, and any updated information you can provide and ill take a look! Thanks

@eleanorjboyd eleanorjboyd added the info-needed Issue requires more information from poster label Dec 12, 2024
@eleanorjboyd eleanorjboyd transferred this issue from microsoft/vscode-python Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug info-needed Issue requires more information from poster needs PR Ready to be worked on
Projects
None yet
Development

No branches or pull requests

8 participants