奇怪的是,VS Code停止接受来自集成和外部端子的输入。一个小时前,它正在用鱼作为拱门上的贝壳。例如,如果我运行以下Python代码:
print('Please enter a number: ', end='')
a = float(input())
print(f'Your number is: {a}')
然后输入1
并按 Enter ,光标将移至下一行,所有执行都将暂停。调试器仍在运行,好像我什么都没有输入一样,但是终端显示了我的输入。当我按下 stop 时,在VS Code的右下角看到错误“ 1000ms后超时”作为警报。
从 Python:当前文件选项生成后,我没有对 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"
}
]
}
我没有通过阅读文档找到任何解决方法。这只是一个将得到修复的错误,还是我做错了什么?
修改
从外壳执行代码通常可以按预期运行。