Remotely debug Python code on Linux from Microsoft Visual Studio 2022: cannot set breakpoint (Breakpoint in file that does not exist)
まだ誰も着手していません。
評価
調査の方向性
まず、この報告を debugpy issue 1240 および Microsoft Visual Studio 2022 のリモート デバッグ設定と比較します。Windows パス C:\pro\XtsUpdater と Linux パス /home/bha/pro/XtsUpdater を使用し、debugpy.listen()、debugpy.wait_for_client()、debugpy.breakpoint() で例を再現します。手動で設定した Visual Studio のブレークポイントが解決され、実行が停止すれば完了です。
索引モデルが issue の本文から書いたものです。
説明
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
)
- 主要言語
- Python
- スター
- 2.5k
- フォーク
- 202
- 平均マージ
- 5日 1時間
- マージ済み PR(30日)
- 1
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/debugpy のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
-
難易度 3/5 1〜2日 初心者へのやさしさ 68/100
microsoft/debugpy の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
stephrobert/dsoxlab#238 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
sublimehq/package_control#1780 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 70/100
nwg-piotr/nwg-displays#145 ·