【问题标题】:Call Stack empty when debugging Python调试 Python 时调用 Stack empty
【发布时间】:2020-10-07 18:01:14
【问题描述】:

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

这仅适用于 Python。例如,对于 C++,它可以工作,如下图所示:

这里是我的配置文件:

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

【问题讨论】:

  • 建议您禁用其他非必要的扩展,以避免它们之间的干扰。另外,请尝试使用其他版本的 Python 扩展并重新加载 VSCode。
  • @JillCheng 我已禁用除 Python 扩展之外的所有扩展,问题仍然存在
  • 我注意到你也提交了这个问题here,而且那个链接里的信息比较全面,所以我把这两个链接连接起来供更多人参考。

标签: python visual-studio-code vscode-debugger vscode-python


【解决方案1】:

发生这种情况是因为我将 'GEVENT_SUPPORT' 环境变量设置为 Trueas @fabioz said,“在 gevent 模式下,调试器希望线程模块能够由 gevent 进行猴子修补,因此它不会跟踪那些(在 gevent 模式下,您只需要 1 个主线程)。”

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2020-03-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-11
    • 2020-12-16
    相关资源
    最近更新 更多