首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用Visual代码远程调试python代码时出错

使用Visual代码远程调试python代码时出错
EN

Stack Overflow用户
提问于 2020-09-23 17:58:10
回答 1查看 528关注 0票数 0

MacOS: 10.15.6 Visual代码: 1.49.1

launch.json:

代码语言:javascript
复制
{
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Remote Attach",
            "type": "python",
            "request": "attach",
            "logToFile": true,
            "justMyCode": false,
            "outputCapture": "std",
            "connect": {
                "host": "localhost",
                "port": 5678
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceFolder}",
                    "remoteRoot": "${workspaceFolder}"
                }
            ]
        }
    ]
}

码头命令码头运行-名称faber -rm -it

-p 0.0.0.0:8020-8027:8020-8027 -p 8028:8028

.

Visual代码日志文件

代码语言:javascript
复制
0 Starting Session:
{
    "name": "Python: Remote Attach",
    "type": "python",
    "request": "attach",
    "logToFile": true,
    "justMyCode": false,
    "outputCapture": "std",
    "connect": {
        "host": "localhost",
        "port": 5678
    },
    "pathMappings": [
        {
            "localRoot": "/Users/j.bora/work/bsi/Blockchain/identity-and-access-management/aries-cloudagent-python",
            "remoteRoot": "/Users/j.bora/work/bsi/Blockchain/identity-and-access-management/aries-cloudagent-python"
        }
    ],
    "debugOptions": [
        "DebugStdLib",
        "RedirectOutput",
        "UnixClient",
        "ShowReturnValue"
    ],
    "showReturnValue": true,
    "workspaceFolder": "/Users/j.bora/work/bsi/Blockchain/identity-and-access-management/aries-cloudagent-python"
}
1 Client --> Adapter:
{
    "command": "initialize",
    "arguments": {
        "clientID": "vscode",
        "clientName": "Visual Studio Code",
        "adapterID": "python",
        "pathFormat": "path",
        "linesStartAt1": true,
        "columnsStartAt1": true,
        "supportsVariableType": true,
        "supportsVariablePaging": true,
        "supportsRunInTerminalRequest": true,
        "locale": "en-us",
        "supportsProgressReporting": true
    },
    "type": "request",
    "seq": 1
}
3 Error:
{}
5 Client --> Adapter:
{
    "command": "disconnect",
    "arguments": {
        "restart": false
    },
    "type": "request",
    "seq": 2
}
6 Error:
{
    "code": "EPIPE"
}
2508 Stopping Session

如上面的日志文件所示,我得到和EPIPE错误。此外,调试器不附加到远程停靠程序进程。请有人帮一下这个错误是怎么回事。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2020-12-01 20:43:12

当我让调试器侦听容器内的localhost而不是0.0.0.0时,我也遇到了同样的问题:

代码语言:javascript
复制
python -m debugpy --listen localhost:5678 myfile.py

在0.0.0.0上运行它解决了这个问题:

代码语言:javascript
复制
python -m debugpy --listen 0.0.0.0:5678 myfile.py
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64033751

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档