Skip to content

Path mappings not working with mixed windows-style/linux path slash #1301

Closed
@gionapaolini

Description

@gionapaolini

I have a launch.json configuration to attach the debugger to a remote service.
This used to work for a long time, not sure when it stopped working exactly.

{
            "name": "Service1",
            "type": "python",
            "request": "attach",
            "connect": {
                "host": "localhost",
                "port": 6005
            },
            "pathMappings": [
                {
                    "localRoot": "${workspaceRoot}/Source",
                    "remoteRoot": "/app"
                }
            ],
            "logToFile": true,
            "justMyCode": false
        }
      ...
}

Gives error:

pydev debugger: unable to find translation for: "c:\path\to\workspace\Source\...\app.py" in ["C:\path\to\workspace/Source/","C:\path\to\workspace/Source"] (please revise your path mappings).

The local root is translated into
C:\path\to\workspace/Source/ (notice the forward slashes at the end, and capital C )
While the pydev debugger is looking for
c:\path\to\workspace\Source\...\app.py

I tried several ways to make it work, by replacing the ${workspaceRoot} variable with the value with lower c, and correct slashes.
But the only way I managed to make it work is to map exactly the full path of the specific file I want to debug. That's the only way I could see and hit the breakpoint on vscode window.

            "pathMappings": [
                {
                    "localRoot": "c:\\path\\to\\workspace\\Source\\...\\app.py",
                    "remoteRoot": "/app/../app.py"
                }
            ]

There are other ways I have tried, many variations with the slashes, but none of them worked. Also sometimes I don't receive the error above, but rather only Breakpoint in file that does not exist.

Is this a vscode issue or debugpy issue?

Metadata

Metadata

Assignees

Labels

Fixed in next releaseThis issue has been fixed, but won't be available to customers until the next release.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions