View Single Post
Old 04-06-2015, 09:14 AM   #12
RobFreundlich
Connoisseur
RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.RobFreundlich ought to be getting tired of karma fortunes by now.
 
Posts: 74
Karma: 10000010
Join Date: Jan 2012
Device: Android Tablet with Calibre Companion and Moon+ Reader Pro
How I debug my recipe

I haven't looked at the paper in a while, so I haven't noticed. But if you want to take on debugging it, power to you! Here's what I do.

First, from my development directory (basically a dir that contains the recipe and some scripts), I run the following command:

ebook-convert "Boston Globe Subscription_1005.recipe" .EPUB --test -vv -debug-pipeline debug --username my_username --password my_password

ebook-convert lives in the Calibre installation directory, so you'll need that on your PATH (it's probably already there). This command tells it to run the recipe in test mode (so it only fetches a couple of sections, and only a couple of articles per section), save all of the steps along the way into a subdirectory called "debug", and create an EPUB file with the results.

The debug subdir will contain subdirs of its own with all of the interim results, with a README.txt describing them.

I then open http://www.bostonglobe.com/todayspaper in Chrome and use Chrome's Developer Tools (Ctrl+Shift+I) to look at the structure of the page and compare that to what the Python code in the recipe is doing, to try to figure out what went wrong.

I'll add self.log() statements to the code to add debugging messages to the console output, or pdb.set_trace() statements to enter the Python debugger where necessary. Some of those are already in the code, commented out, at strategic points.

I also recommend reading the docs on how to write custom recipes (referenced elsewhere in this forum, I think). And feel free to PM me if you'd like my email address or IM info to get more direct help.
RobFreundlich is offline   Reply With Quote