View Single Post
Old 02-28-2010, 06:02 PM   #8
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 74,075
Karma: 315558332
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Oasis
Quote:
Originally Posted by kovidgoyal View Post
Stick it in the the plugin zip file. If your extra modules don't contain any compiled code (files ending with .so) that is all you need to do. If they do, the you have to unzip the zip file into a temporary directory and add that to sys.path in your plugin code.
I've had a go at this, and the module still isn't found. I tried taking the try: clause out from around the import statements, and now when I try to add the plug-in to Calibre I get

ERROR: ERROR: Unhandled exception: <b>ImportError</b>:No module named Crypto.Cipher

Traceback (most recent call last):
File "site-packages/calibre/gui2/dialogs/config/__init__.py", line 531, in add_plugin
File "site-packages/calibre/customize/ui.py", line 271, in add_plugin
File "site-packages/calibre/customize/ui.py", line 67, in load_plugin
File "<string>", line 34, in <module>
ImportError: No module named Crypto.Cipher


Looking at ui.py, line 67, it seems to me that at this point it has only decompressed the _plugin file, and not the module that's also included in the zip file. If it does a similar ting later when trying to execute, that would explain why things are not working.

Perhaps I'll need to do what you suggested later, and include the module as a zipped file, and explicitly unzip to a temporary folder and add to sys.path?

Or should it be working, and I've just done something wrong in adding in the module to the zip file?

Thanks.
pdurrant is offline   Reply With Quote