question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Run python file in terminal ignores default terminal

See original GitHub issue

Environment data

  • VS Code version: 1.60
  • Extension version (available under the Extensions sidebar): v2021.9.1191016588
  • OS and version: Windows 10
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8 with Anaconda
  • Type of virtual environment used (N/A | venv | virtualenv | conda | …): conda
  • Relevant/affected Python packages and their versions: None
  • Relevant/affected Python-related VS Code extensions and their versions: None
  • Value of the python.languageServer setting: Pylance

Expected behavior

By clicking “Run Python File in Terminal” a new terminal instance of the default terminal is started and the code is executed with the selected env.

Actual behavior

Since the latest version, on a windows machine, a new terminal instance of the PowerShell is started regardless of the default terminal. Is this the expected behavior?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:10
  • Comments:6

github_iconTop GitHub Comments

4reactions
karrtikrcommented, Sep 7, 2021

I can reproduce the issue, thanks. It seems @bpmckim is right and it’s a VSCode issue 🙂

We use the API vscode.window.createTerminal to create a new terminal, which we expect to respect the default terminal setting, but it seems that’s not happening. Opened an issue on VSCode https://github.com/microsoft/vscode/issues/132583.

3reactions
flash-mecommented, Sep 5, 2021

Can confirm,

VS Code: 1.60 Vs Code Python: v2021.9.1191016588

User settings:

{
    "terminal.integrated.defaultProfile.windows": "Git Bash",
    "terminal.external.windowsExec": "C:\\Program Files\\Git\\bin\\bash.exe"
}

Workspace settings:

{
    "python.pythonPath": ".venv\\Scripts\\python.exe",
}

Weird behaviour:

  • Run Python file in terminal → Powershell
  • Debug Python file in terminalGit Bash as expected

Kinda annoying…

cheers flash ⚡

Read more comments on GitHub >

github_iconTop Results From Across the Web

VSCode's "Run Python File" button doesn't sync with default ...
I have set my default terminal as cmd in VSCode however, everytime I press "Run Python File" button on top right corner it...
Read more >
unittest — Unit testing framework — Python 3.11.1 ...
Source code: Lib/unittest/__init__.py(If you are already familiar with the basic concepts of testing, you might want to skip to the list of assert...
Read more >
django-admin and manage.py
Run django-admin help --commands to display a list of all available commands. Run django-admin help <command> to display a description of the given...
Read more >
Command Line Arguments for Your Python Script
In macOS or Linux, you have the Terminal or xterm. Running a Python script in command line is powerful because you can pass...
Read more >
Windows Terminal General Profile Settings - Microsoft Learn
json file, to declare this path, you can use the Browse... button to select your starting directory or enter the WSL path as:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found