VS Code Python Debugger “timed out waiting for debuggee to spawn”

帅比萌擦擦* 提交于 2021-02-07 09:16:08

问题


My debugger doesn't even begin to run my code. I press F5, the debug tab opens, shows that it is loading, and after a while it says "Session-1 timed out waiting for debuggee to spawn" in a pop-up window. I'm using VS Code version 1.40.1, I have my virtual environment setup, and the debugger used to work, stopping at breakpoints and changing the color of the blue bar at the bottom of the screen. Issue appeared while messing with the open() function, but the debugger doesn't work with any file. I have seen and tried the solutions offered here and here. I don't use Conda, Jupyter, or any extensions besides the standard Python extension. Code:

import os
def fib(n):
    if not os.path.exists("Fibfile.txt"):
        with open("Fibfile.txt", "w") as file:
            file.write("1\n2\n")
    with open("Fibfile.txt", "r") as file:
        contents = file.readlines()
        data = []
        for item in contents:
            # removes newline
            data.append(int(item[:-1]))
    with open("Fibfile.txt", "a") as file:
        if n <= len(data):
            return
        else:
            while n > len(data):
                data.append(data[-2]+data[-1])
                file.write(f"{data[-1]}\n")
fib(100)

My 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: Arquivo Atual",
        "type": "python",
        "request": "launch",
        "program": "${file}",
        "console": "integratedTerminal"
    }
]
}

回答1:


My solution is downgrade Python extension for Visual Studio Code. You can download from GitHub release. PTVSD release 2019.10.44104 is fine with VS Code 1.40.2. Unchecked Extensions: Auto Update/Auto Check Updates and install from VSIX manually.

Update: Newer version VS Code 1.41 fix this issue already.



来源:https://stackoverflow.com/questions/59012582/vs-code-python-debugger-timed-out-waiting-for-debuggee-to-spawn

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!