Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở
#1,599 2 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
25/100
Loại issue
Lỗi
Độ rõ ràng
Cần làm rõ
Mức độ hoạt động
Đình trệ
Công nghệ
python
Lĩnh vực
devtools

Hướng nghiên cứu

Bắt đầu bằng cách so sánh báo cáo này với debugpy issue 1240 và thiết lập gỡ lỗi từ xa của Microsoft Visual Studio 2022. Tái hiện ví dụ bằng debugpy.listen(), debugpy.wait_for_client() và debugpy.breakpoint(), với đường dẫn Windows C:\pro\XtsUpdater và đường dẫn Linux /home/bha/pro/XtsUpdater. Hoàn thành khi các điểm ngắt Visual Studio được đặt thủ công được phân giải và dừng quá trình thực thi.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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
)

Ngôn ngữ chính
Python
Star
2.5k
Fork
202
Merge trung bình
5 ngày 1 giờ
Pull request đã merge (30 ngày)
1

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của microsoft/debugpy

Tất cả issue của microsoft/debugpy

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.