Skip to content

Modules with two leading slashes can't be mapped properly in VS Code debugger #1061

Description

@OEP

Hi, this is a follow-up to a discussion: microsoft/vscode-python#19835

EDIT: See microsoft/vscode#161498 for resolution.

Environment data

  • debugpy version: 1.6.3
  • OS and version: CentOS 7.9, macOS 11.6.2 (Big Sur)
  • Python version : Tested on 3.9 (macOS), 3.7 and 3.6 (CentOS)
  • Using VS Code or Visual Studio: VS Code

Actual behavior

In VS Code, breakpoint is hit, but path-mapping does not work with an error in the editor pane.

The editor could not be opened because the file was not found.

Creating the file tries to mkdir /vscode-path and fails.

In a more complex example that I couldn't find a MWE for, the Call Stack pane in VS Code says:

[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")

Expected behavior

Breakpoint is hit and the path-mapping works.

Steps to reproduce:

Create a file like the following:

$ cat /tmp/vscode-path/vscode_blah.py 
import sys
import pprint
pprint.pprint(sys.path)

import debugpy
debugpy.listen(5678)
print("WAIT")
debugpy.wait_for_client()

print("HEY")

Create a standard "remote attach" debug configuration.

{
        "host": "localhost",
        "name": "Remote Attach",
        "port": 5678,
        "request": "attach",
        "type": "python"
}

In the VS Code editor, set a breakpoint on the final print().

Try to import it via a PYTHONPATH with a leading double slash.

$ PYTHONPATH=//tmp/vscode-path python3 -c "import vscode_blah"

Attach via the debugger.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions