Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Remotely debug Python code on Linux from Microsoft Visual Studio 2022: cannot set breakpoint (Breakpoint in file that does not exist)

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

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
25/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
python
Ambito
devtools

Direzione di ricerca

Inizia confrontando questo report con debugpy issue 1240 e con la configurazione del debug remoto di Microsoft Visual Studio 2022. Riproduci l’esempio usando debugpy.listen(), debugpy.wait_for_client() e debugpy.breakpoint(), con il percorso Windows C:\pro\XtsUpdater e il percorso Linux /home/bha/pro/XtsUpdater. Il lavoro è terminato quando i punti di interruzione di Visual Studio impostati manualmente vengono risolti e arrestano l’esecuzione.

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

Descrizione

Hi,
This one looks like https://github.com/microsoft/debugpy/issues/1240 but as i'm using Microsoft Visual studio 2022 and not Visual code, i cannot specify file path mapping or i don't know how to di it.
The problems seems to come from the fact that the file path on my windows machine is not the same than thge one on my linux ubuntu machine. The file names and content are equal.

Environment data

-debugpy==1.8.1

  • Windows 11/ Linux Ubuntu
  • Python version 3.10
  • Using Visual Studio:

Actual behavior

  • Breakpoint manually set in microsoft visual studio ide are not fill red bullet (not set with message 'Breakpoint in file that does not exist')
  • Breakpoint set in python code by debugpy.breakpoint(); works and i can step in my code and see variables content

Expected behavior

Breakpoint manually set in microsoft visual studio ide should be full red bullet and should stop the app when hitted :-)

I suspect that the problem comes from the fact that the sources code files are not located in the same path in the host and remote machine:
-windows: C:\pro\XtsUpdater
-linux: /home/bha/pro/XtsUpdater

With Vscode you can specify file path mapping in launch.json but how to do this in Microsoft visual studio 2020 ???

Code

from flask import Flask
import socket
xts_updater_service = Flask(name)

import debugpy

@xts_updater_service.route('/')
def hello_world():
debugpy.breakpoint();
hostname = socket.gethostname()
message = "Hello world from '" + hostname + "'\n"
return message

if name == 'main':
print(f"Starting Debug Lister on port 5678")
debugpy.listen(('0.0.0.0', 5678))
print("Waiting for debugger attach")
debugpy.wait_for_client()
debugpy.breakpoint();
print(f"Launch http server on port 8081")
xts_updater_service.run(host='0.0.0.0', port=8081
)

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.