For days now I'm trying to get PyDev's remote debugging feature to run without success. My main problem (and only one for now) is that I don't know how to correctly map remote paths onto my local ones and vice versa in order to make breakpoints work. I've read through these instructions and also skimmed through a few Q/A here on SO on that topic. I'd like to know what the exact steps are to make those breakpoints function properly.
In my case it's a Python application running on a remote Debian 9 system which I want to debug from my local Windows 7 host with PyDev 6.4.3 inside Eclipse. What's the host and what's the target in this case? Do I have to configure my path mappings on my Windows or the Linux machine? Or even both?
I tried configuring them in Eclipse under Preferences / PyDev / Debug / Source Locator. I set them up as an environment variable PATHS_FROM_ECLIPSE_TO_PYTHON both on Windows and Linux. Nothing of that helped, on my Linux machine I just get the message
pydev debugger: warning: trying to add breakpoint to file that does not exist
I ran out of options and would really like to know what's the correct way of doing that. Any help is appreciated.
So, I finally found out the right configuration for my setup. To sum it up:
pip install pydevd
)Apparently one has to configure the path mappings on the target machine (the one hosting the application you want to debug, so in my case this would be the Linux machine). This can be done in two ways (on Linux):
Pasting them directly into pydevd_file_utils.py
(on my Linux system it's residing inside /usr/local/lib/python2.7/dist-packages/) in the form:
PATHS_FROM_ECLIPSE_TO_PYTHON = [
('Remote Path 1', 'Local Path 1'),
('Remote Path 2', 'Local Path 2'),
...
]
Passing them as an environment variable (e.g. like export PATHS_FROM_ECLIPSE_TO_PYTHON='[["Remote Path 1", "Local Path 1"], ["Remote Path 2", "Local Path 2"], ...]'
) before launching your application
In my case remote path would be the project path on my Windows machine (e.g. C:\\Users\\workspace\\project\\
) and local path the one on my Linux host (/home/user/project/
). Notice the trailing backslashes I had to add to the paths because otherwise PyDev would translate the paths to something like /home/user/project\file.py
which results in an unknown file. As a consequence I additionally had to escape the backslashes in the Windows paths.
Hope this helps anyone who runs into similar difficulties like mine.