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:

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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With