microsoft / debugpy

An implementation of the Debug Adapter Protocol for Python
https://pypi.org/project/debugpy/
Other
1.87k stars 139 forks source link

Non-useful and non-breaking "Unable to find python module." when debugging from msys2 and vscode #1735

Closed epigramx closed 1 day ago

epigramx commented 2 weeks ago

This appears to be a sideeffect of msys2 having its pseudo-UNIX like dir structure, and debugpy trying windows-like paths.

python -m debugpy --listen 0.0.0.0:0 test.py
0.00s - Debugger warning: It seems that frozen modules are being used, which may
0.00s - make the debugger miss breakpoints. Please pass -Xfrozen_modules=off
0.00s - to python to disable frozen modules.
0.00s - Note: Debugging will proceed. Set PYDEVD_DISABLE_FILE_VALIDATION=1 to disable this validation.
Unable to find python module. 
Unable to find python module.
Unable to find python module.
Unable to find python module.
Unable to find python module.
Unable to find python module.
Unable to find python module.

(and same warnings in VSCode)

There is no such warning if instead of the python installation/venv of msys2: a windows installation of python is used as the default interpreter in VScode.

The issue does not affect the actual operation of the python program debugged but I don't know if it affects the debugger (it's very spammy though).

rchiodo commented 1 day ago

That error is output here: https://github.com/microsoft/debugpy/blob/f4ba976121ce38ee1c7c1f3174fcc520bccc7e19/src/debugpy/_vendored/pydevd/pydevd_attach_to_process/windows/py_win_helpers.hpp

My guess is that this isn't going to work because the code that's doing the attach thinks this is a windows machine and the HMODULEs for the python dll aren't going to be found.