When I 'Run Selected' in Python on Visual Studio Code, it is suddenly opening up two Python terminals, one of which does not run my Python code

huangapple go评论77阅读模式
英文:

When I 'Run Selected' in Python on Visual Studio Code, it is suddenly opening up two Python terminals, one of which does not run my Python code

问题

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

然后突然间,当我像往常一样使用<kbd>Shift</kbd>+<kbd>Enter</kbd>运行我的一些选定代码时,它打开了两个终端,不允许我在正常的Python终端中运行代码。它只允许我在第二个Python终端中运行。

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

  • 重新安装VS Code和扩展

  • 删除所有JSON上的用户设置

  • 确保我已经选择了Python解释器

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.

第一个Python终端似乎没问题,但我似乎无法在那个终端中运行我的代码,因为第二个终端挡住了。

英文:

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 <kbd>Shift</kbd>+<kbd>Enter</kbd> 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

When I 'Run Selected' in Python on Visual Studio Code, it is suddenly opening up two Python terminals, one of which does not run my Python code

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.

答案1

得分: 2

这是由于最近版本的Python扩展中存在的一个错误。已经在 https://github.com/microsoft/vscode-python/issues/21393 中报告了此问题。此修复已应用于稳定通道用户的v2023.10.1版本,以及内部版本用户的v2023.11.11651007版本。

在修复之前,你可以通过回滚到扩展的旧版本来解决此问题(参见 https://stackoverflow.com/q/42626065/11107541)。其他用户报告称v.2023.8.0没有此问题。

该问题由一个新的终端功能引起,由于测试用例的空白和VS Code内部版本用户未能注意到,因此未被注意到。扩展的维护人员于6月13日或14日撤销了此更改(参见 https://github.com/microsoft/vscode-python/pull/21418)(来源)。

我将持续关注此问题并会在有新信息时更新此帖子。你可以订阅该问题的票据,或关注此回答帖子以获取关于长期修复的更新。

英文:

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 https://stackoverflow.com/q/42626065/11107541). 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.

huangapple
  • 本文由 发表于 2023年6月12日 01:17:26
  • 转载请务必保留本文链接:https://go.coder-hub.com/76451639.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定