调试Python时调用堆栈为空

2024-05-07 20:14:19 发布

您现在位置:Python中文网/ 问答频道 /正文

我在一个使用VSCode和Python扩展的Python多线程项目中工作。 一切都正常工作,直到突然(我没有更改任何设置),它停止显示调用堆栈中正在运行的进程和线程。调用堆栈现在是空的,直到它在断点上停止

这只适用于Python。对于C++,例如,它工作,如下面的图像:

c++ call stack; showing running threads

以下是我的配置文件:

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

Tags: to项目图像jsonfalsetrue进程堆栈
1条回答
网友
1楼 · 发布于 2024-05-07 20:14:19

之所以发生这种情况,是因为我将“GEVENT\u SUPPORT”环境变量设置为True,并且as @fabioz said,“在GEVENT模式下,调试器希望线程模块由GEVENT进行猴子补丁,因此它不会跟踪这些模块(在GEVENT模式下,您只需要有一个主线程)。”

相关问题 更多 >