2

I was developing some Python code for work, using Python extension v2023.10.0 on VS Code. It was working completely fine before.

Then all of a sudden when I ran some of my selected code as usual with Shift+Enter on my Python code, it opened up two terminals and won't allow me to run the code in a normal Python terminal. It only allows me to run in that second Python terminal there.

Why is this happening, and how can this be fixed?

I did not change any settings, so I'm surprised by the sudden change. I have tried:

  • Reinstalling VS Code and Extensions
  • Deleting all User Settings on JSON
  • Making sure that I've selected a Python Interpreter

enter image description here

The first Python terminal seems okay, but I can't seem to run my code in that terminal, because the second one is in the way.

starball
  • 20,030
  • 7
  • 43
  • 238
kodikai
  • 374
  • 1
  • 10
  • the powershell command line does not understand Python, you have to call `python` plus a script, or type these lines in a REPL – rioV8 Jun 11 '23 at 17:21
  • 1
    same question here posted just a while before yours: https://stackoverflow.com/q/76448860/11107541. Issue is tracked on GitHub here: https://github.com/microsoft/vscode-python/issues/21393 – starball Jun 11 '23 at 22:01
  • Thanks so much @starball, those links were so helpful. A couple people suggested rolling back to v2023.8.0. I'm suspecting it's something to do with the latest release.That seemed to do the trick! Will be following these two issues. https://github.com/microsoft/vscode/issues/184790 https://github.com/microsoft/vscode-python/issues/21393 – kodikai Jun 12 '23 at 03:04

1 Answers1

2

This is due to a bug in the recent version of the Python extension. It has been reported in https://github.com/microsoft/vscode-python/issues/21393. This fix has been made for Stable channel users v2023.10.1, and for Insiders users in v2023.11.11651007.

Before the fix was made, a workaround, you could roll back to an older version of the extension (see VS Code - how to rollback extension/install specific extension version). Other users have reported that v.2023.8.0 does not have this issue.

The issue was caused by a new terminal feature and it wasn't noticed due to a gap in test cases and VS Code Insiders users not noticing. The maintainers of the extension reverted the change (see https://github.com/microsoft/vscode-python/pull/21418) on June 13th or 14th (source).

I'm watching that issue tickets and will update this post with more info as it comes. You can subscribe to the issue ticket, or follow this answer post to get updates on long-term fixes.

starball
  • 20,030
  • 7
  • 43
  • 238