View Single Post
Old 08-23-2012, 06:48 PM   #2
kiwidude
Calibre Plugins Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,637
Karma: 2162064
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Two choices when it comes to metadata download plugins (assuming Windows).

First option - install it in calibre, and use the GUI to run it, you have the View Log button in the GUI to see any log output you have. For normal UI plugins, you can launch calibre with calibre-debug -g and have the logging printed to the console. This doesn't work with metadata plugins however.

Second option - take a look at any of my plugins like the B&N plugin. At the bottom of __init__.py, you will see a "if __name__ == '__main__'" section. This is to allow testing the plugin from a command line outside of calibre. You can see the command line to launch it from the plugin directory:
Code:
calibre-debug -e __init__.py
When you do this, you will get some log output to the console window, and the rest gets written to a file, the location of which is specified in the console output.

One very important note - executing plugin codes in this way will *only* load the local directory version of the file that you launched in that command line - in this case __init__.py. If your plugin has other files that need to be called (worker.py in the case of the B&N plugin), then they *must* be installed first in calibre by installing your plugin using the normal command line route.

And remember that any time you make a change to one of those supporting files, you must run the command line again to re-zip/add the plugin to calibre, before then running the command line above to execute your test code. Otherwise your code is going to be using the "old" version of those files that calibre knows about (not the ones in the local directory remember). You can drive yourself mental making changes and seeing them have no effect (I did until I figured this out!).

Having said all of the above, I know Kovid made some changes a month or two ago to support other ways of installing/testing plugins. It may be there is a quicker way of doing it. I'm too set in my ways with all my existing batch files etc I have "honed" over the years to break my habits just yet but he may have a better answer for you.
kiwidude is offline   Reply With Quote