View Single Post
Old 07-17-2011, 05:50 PM   #1
siebert
Developer
siebert has a complete set of Star Wars action figures.siebert has a complete set of Star Wars action figures.siebert has a complete set of Star Wars action figures.
 
Posts: 155
Karma: 280
Join Date: Nov 2010
Device: Kindle 3 (Keyboard) 3G / iPad 9 WiFi / Google Pixel 6a (Android)
HowTo: Debug calibre with Eclipse/PyDev

Hi,

using a debugger with calibre is rather difficult, but I've managed to get the PyDev debugger working via remote debugging.

Here are the necessary steps:

- Set up calibre development for your platform (I'm using Windows 7 64bit): http://manual.calibre-ebook.com/develop.html
- Set up PyDev remote debugging: http://pydev.org/manual_adv_remote_debugger.html. For step 3 "Make sure pydevd.py is in your pythonpath" I've copied the required files to the src directory of calibre.
- Locate the source code to debug and add the line
Code:
import pydevd;pydevd.settrace()
- Start the PyDev remote debugger server
- Start calibre with "calibre-debug -g"
- When the added line is reached, the debugger will stop. You can continue from there, set break points etc.

Please note that it doesn't work to add the debug line at the calibre startup code and single step from there through the whole application, as the calibre startup is rather tricky and different threads are running. So it's best to just add the line (even at multiple locations) where you would normally set your breakpoint.

Happy debugging,
Steffen
siebert is offline   Reply With Quote