Skip to content

Source lookup fails for paths with “.zip_\” segment #1964

@vvvPexota

Description

@vvvPexota

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.8.15
  • OS and version: XXX: Microsoft Windows 11 Enterprise , 10.0.22631 N/A Build 22631
  • Python version : Python 3.8.9
  • Using VS Code or Visual Studio: VS Code

Actual behavior

When attaching from VS Code (debugger in listen mode) to a target process that calls debugpy.connect(...), if the script’s path contains a directory segment like ...\archive.zip_\files... (this is a normal folder, not an archive), VS Code shows:
Unable to retrieve source for C:\repro\archive.zip_\files\app\script.py
Note the path is displayed as zip_\files, whereas the actual on-disk path is zip_\files. Because of this mismatch, the source cannot be opened, breakpoints remain unresolved, and stepping falls back to a top-level exec frame.

Renaming the folder so it does not contain .zip_ makes the problem disappear.

Expected behavior

The debugger should treat the file system path literally and open the source without rewriting segments around .zip. Breakpoints should bind and stepping should work normally for any valid Windows path.

Steps to reproduce:

  1. Create the following directory structure:
    C:\repro\archive.zip_\files\app\

  2. Create C:\repro\archive.zip_\files\app\script.py with:
    import debugpy
    debugpy.connect(("127.0.0.1", 9092))
    debugpy.breakpoint()
    print(file)

In VS Code, open C:\repro\archive.zip_\files\app\ as the workspace and add .vscode/launch.json:
{
"version": "0.2.0",
"configurations": [
{
"name": "Listen 9092",
"type": "python",
"request": "attach",
"listen": { "host": "127.0.0.1", "port": 9092 },
"pathMappings": [
{
"remoteRoot": "C:\repro\archive.zip_\files\app",
"localRoot": "C:\repro\archive.zip_\files\app"
}
],
"justMyCode": true
}
]
}

  1. Start the Listen 9092 configuration in VS Code.
  2. In a separate console, run: python C:\repro\archive.zip_\files\app\script.py
  3. BOOM

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