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

VS Code and Python: configure the "Run" button next to the editor tabs #20746

Closed
xxc-zsz opened this issue Feb 24, 2023 · 2 comments
Closed

VS Code and Python: configure the "Run" button next to the editor tabs #20746

xxc-zsz opened this issue Feb 24, 2023 · 2 comments
Labels
feature-request Request for new features or functionality info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team

Comments

@xxc-zsz
Copy link

xxc-zsz commented Feb 24, 2023

I have the following configuration in my launch.json:

{
    "configurations": 
    [
    {
      "name": "Python: Current File",
      "type": "python",
      "request": "launch",
      "program": "${file}",
      "console": "integratedTerminal",
      "justMyCode": true,
      "cwd": "${fileDirname}",
      "env": {"PYTHONPATH": "C:/repo/python"}
    }
    ]
}

With this, I can easily run and debug the current script from the Run/Debug side panel:

enter image description here

All good, so far. But now I'd like to also be able to directly run the script from the Run button on the editor tabs:

enter image description here

Unfortunately, this does not work. It runs the file, but the configuration from above is not taken.

How can I add a configuration with PYTHONPATH etc. also for this Run button in the editor tabs?

@xxc-zsz xxc-zsz added the feature-request Request for new features or functionality label Feb 24, 2023
@github-actions github-actions bot added the triage-needed Needs assignment to the proper sub-team label Feb 24, 2023
@karrtikr
Copy link

Try using the debug option to pick up launch.json config automatically:

@karrtikr karrtikr added the info-needed Issue requires more information from poster label Feb 25, 2023
@luabud
Copy link
Member

luabud commented Feb 27, 2023

Dupe of #11812

@luabud luabud closed this as completed Feb 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality info-needed Issue requires more information from poster triage-needed Needs assignment to the proper sub-team
Projects
None yet
Development

No branches or pull requests

3 participants