简体   繁体   中英

PyDev Debugging

My interpreter is the python 2.6 interpreter that comes with cygwin.

I have a pydev project that contains a linked folder. In the folder, due to outside constraints, I have two sub-folders, one with a bunch of scripts I develop, and one which serves as the run directory for all my run configurations.

When I run the project (not debug) everything works fine.

However, when I choose to debug the project, my custom modules aren't found, and the import fails.

I tried adding my scripts folder to PYTHONPATH, but that didn't help, and when I printed sys.path It contained weird stuff, all of the form:

<path to run directory>/<path to entry in PYTHONPATH>

I can't make heads or tails out of it.

I'll appreciate any help.

Unfortunately, that's a known issue. PyDev does not support Cygwin for debugging. The primary reason is that the paths that Python reports don't match the paths you configure in windows, so, a translation step would be needed for each path (even some other areas such as code-completion or code-analysis could have problems).

You can probably do this translation yourself at eclipse/plugins/org.python.pydev_x.xx/pysrc/pydevd_file_utils.py (instructions on the file), but note that this may be more work than it's worth (the recommended approach is using a native Python install on Windows instead of through cygwin) -- or if you need an interpreter on Linux, develop on Linux :)

Thanks, you made my day, its actually very easy,

you have to change the PATHS_FROM_ECLIPSE_TO_PYTHON variable inside pydevd_file_utils.py as,

PATHS_FROM_ECLIPSE_TO_PYTHON = [ (r'C:\\Users\\usernam\\workspace-cpp\\python-proj\\src', r'/cygdrive/c/Users/usernam/workspace-cpp/python-proj/src') ]

But this needs to be changed for all your own python source files you desire to debug

I am happy to announce a new release of ePyUnit, which solves the load-path issue of 'pydevd.py'. This works from within Eclipse/PyDev as well as from an arbitrary process started from the command line.

ePyUnit now includes the automation of remote debugging with PyDev and Eclipse by 'pydevd.py'. This works seamlessly for the 'subprocess' call as well as independently started command line processes.

See:

For basics of remote debugging:

Also enhanced unittest integration into PyUnit.

Comments and fixes are welcome.

Have fun...

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM