- pydev-Debug-Server zeigt Fehler an, der nicht zutrifft
- pydev-Debugger: Übersetzung konnte nicht gefunden werden für: (bitte überarbeiten Sie Ihre Pfadzuordnungen)
- https://stackoverflow.com/a/41765551/1497139
Meine IDE ist Eclipse 2025-12 auf Mac OS mit LiClipse und pydev 13.0.1.202502081502.
Remote-Debugging funktioniert gut, wenn mein Zielcomputer kein Venv verwendet und sogar mit Venv
wenn ich mit der Pfadzuordnung herumspiele, z. B. mit einem Ziel von Ubuntu 22 und Python 3.10/3.11
Die Dinge werden für mich unkontrollierbar, wenn das Ziel Ubuntu 24 LTS ist. Ich habe Python 3.12, was mich zwingt, venv zu verwenden.
Wenn ich das mache, sind die PYTHONPATH-Einträge nicht mehr einfach.
Ich versuche, dies mit python -e zu mildern installiert.
Ich starte dann den Debugger mit einem Remote-Tunnel
Code: Select all
ssh -R 5678:localhost:5678 ubuntu ". .profile;bin/debug_cms"
https://github.com/WolfgangFahl/pybasem ... ase_cmd.py
und der Zuordnung
Code: Select all
--debugRemotePath /Users/wf/py-workspace/,/Users/wf/Library/Python/3.12/lib/python/site-packages/basemkit/ \
--debugLocalPath /home/wf/source/python/,/home/wf/source/python/pybasemkit
Code: Select all
pydev debugger: Trying to add breakpoint to file that does not exist: /Users/wf/Library/Python/3.12/lib/python/site-packages/basemkit/base_cmd.py (will have no effect).
Wenn ich die Pfadzuordnung auf die einfachere ändere
Code: Select all
--debugRemotePath /Users/wf/py-workspace/ \
--debugLocalPath /home/wf/source/python
Code: Select all
➜ starting python -X frozen_modules=off -m frontend.cmsmain --serve --host 0.0.0.0
Local=qn.bitplan.com
Remote=127.0.0.1
DEBUG: I am running in: /home/wf/source/python/pyWikiCMS
DEBUG: This file is at: /home/wf/source/python/pybasemkit/basemkit/base_cmd.py
DEBUG PATH MAP: Remote (IDE)='/Users/wf/py-workspace/' Local='/home/wf/source/python' ✅
1.07s - pydev debugger: unable to find translation for: "/Users/wf/Library/Python/3.12/lib/python/site-packages/basemkit/base_cmd.py" in ["/Users/wf/py-workspace/", "/Users/wf/py-workspace"] (please revise your path mappings).
die Json-basierte Zuordnung
Code: Select all
[
{
"localRoot": "...",
"remoteRoot": "..."
}
]
Leider verfolgt mich das seit 2011 https://stackoverflow.com/a/41765551/1497139
und selbst 14 Jahre später bin ich immer noch verwirrt und verstehe nicht, wie die Zuordnung richtig funktionieren soll. Ich habe es einige Jahre lang laufen lassen und war glücklich, die Komplexität zu verbergen, und jetzt ist es wieder in vollem Gange.
Was kann getan werden, um venv-basierte Projekte korrekt abzubilden?
Zum Debuggen verwende ich
Code: Select all
export PYDEVD_DEBUG=1
export DEBUG_PYDEVD_PATHS_TRANSLATION=1
export PYDEVD_LOG_DIR=/tmp/pydevd
zu verstehen
Code: Select all
if args.debugServer:
import pydevd
import pydevd_file_utils
remote_path = args.debugRemotePath
local_path = args.debugLocalPath
# note the complexity of https://stackoverflow.com/a/41765551/1497139
# discussed in 2011
if remote_path and local_path:
remotes = [r.strip() for r in remote_path.split(",")]
locals_ = [l.strip() for l in local_path.split(",")]
if len(remotes) != len(locals_):
raise ValueError("debugRemotePath and debugLocalPath must have the same number of entries")
mappings = list(zip(remotes, locals_))
if args.debug:
fqdn = socket.getfqdn()
print(f"Local={fqdn}",file=sys.stderr)
print(f"Remote={args.debugServer}",file=sys.stderr)
print(f"DEBUG: I am running in: {os.getcwd()}",file=sys.stderr)
print(f"DEBUG: This file is at: {os.path.abspath(__file__)}",file=sys.stderr)
for r, l in mappings:
marker="✅" if os.path.exists(l) else "❌"
print(f"DEBUG PATH MAP: Remote (IDE)='{r}' Local='{l}' {marker}", file=sys.stderr)
# https://github.com/fabioz/PyDev.Debugger/blob/main/pydevd_file_utils.py
pydevd_file_utils.setup_client_server_paths(mappings)
pydevd.settrace(
args.debugServer,
port=args.debugPort,
stdoutToServer=True,
stderrToServer=True,
suspend=True
)
print("Remote debugger attached.")
Mobile version