Visual Studio Codeでpythonを実行しようとした時に「Timeout waiting for debugger connection」または「Time out waiting for debugger to spawn」というエラーが発生した場合の対処法を説明しています。
エラーとしては以下のような内容です。
結果としては、「launch.json」の「console」の設定を変更することで改善しました。
「launch.json」を開くと元々以下のようになっていると思います。
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal",
"justMyCode": true
}
]
}
この中の「console」の設定を
"integratedTerminal" → "internalConsole"
のように変更することで改善しました。
{
// IntelliSense を使用して利用可能な属性を学べます。
// 既存の属性の説明をホバーして表示します。
// 詳細情報は次を確認してください: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "${file}",
"console": "internalConsole",
"justMyCode": true
}
]
}