Skip to content
Advertisement

Call Stack empty when debugging Python

I am working in a multithreading project in Python using VSCode and the Python extension. Everything was working right until suddenly, without me changing any setting) it stopped showing the running processes and threads in the Call Stack. The Call Stack is now empty until it stops on a breakpoint.

This is only for Python. For C++, e.g, it works, as shown in the following image:

c++ call stack; showing running threads

Here follow my configuration files:

settings.json:

{
    "python.pythonPath": "C:\Users\tiago\AppData\Local\Programs\Python\Python38\python.exe",
    "python.linting.pylintEnabled": false,
    "python.linting.enabled": true,
    "python.linting.pylamaEnabled": false,
    "python.linting.flake8Enabled": true
}

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": "externalTerminal"
        }
    ]
}

Advertisement

Answer

This was happening because I had the ‘GEVENT_SUPPORT‘ environment variable set to True, and as @fabioz said, “In the gevent mode the debugger expects the threading modules to be monkey-patched by gevent and thus it doesn’t track those (as in gevent mode you’re only expected to have 1 main thread).”

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement