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

Aperta
#1,964 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
74/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python, vscode

Direzione di ricerca

Riproduci il problema con C:\repro\archive.zip_\files\app\script.py e la configurazione .vscode/launch.json, usando debugpy.connect() e debugpy.breakpoint(). Inizia tracciando la ricerca del sorgente e la gestione della mappatura dei percorsi per il segmento .zip_ su Windows. Il lavoro è completato quando il percorso letterale si apre in VS Code, i breakpoint vengono associati e lo stepping non ricade più in un frame exec di livello superiore.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

bug

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
Lingua principale
Python
Stelle
2.5k
Fork
202
Merge medio
5g 1h
PR unite (30g)
1

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/debugpy

Tutte le issue di microsoft/debugpy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.