【发布时间】:2020-12-06 02:48:32
【问题描述】:
在这段两行python代码中:
string = input("What's your name? ")
if string != '': print('Hello, ' + string + '!')
当我运行调试时,它会等待用户输入。输入名称后,终端(Python 调试控制台)就停在那里,print() 行永远不会被执行。 See the screenshot below
launch.json 文件如下(默认):
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
如果我在不调试的情况下运行此代码,一切正常。
注意:调试器之前工作正常。这个问题最近才发生。 非常感谢任何帮助或提示。
【问题讨论】:
-
尝试删除断点
-
@eggheadlabs 由于调试功能是由python扩展提供的,您可以尝试禁用其他扩展并重新安装python扩展(或使用其他版本的python扩展)。参考:github.com/microsoft/vscode-python/issues/1125
-
@JillCheng 感谢您的建议。我已经将 python 扩展回滚到以前的版本(v2020.7.96456),然后问题就消失了,一切正常。在我看来,最新版本(v2020.8.101144)中引入了一个错误。我也尝试卸载并重新安装最新版本,但问题仍然存在。
标签: python debugging input visual-studio-code