Reputation: 116
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"
}
]
}
Upvotes: 9
Views: 18437
Reputation: 31
Upvotes: 2
Reputation: 39
I had the same error, and I solved this problem by setting DEBUGPY_PROCESS_SPAWN_TIMEOUT
environment variable to a desired value.
So I just add export DEBUGPY_PROCESS_SPAWN_TIMEOUT=1200
to the ~/.profile
and solved it.
For details, you can refer to this issue.
Upvotes: 1
Reputation: 9
the python version is conflict with python debugger version. Change an older python debugger version or python version.
Upvotes: 1
Reputation: 41
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.
Upvotes: 4