Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 03-24-2011, 04:04 AM   #1
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
ZipImportError: not a Zip file (most plugins)

Hi everybody,
I've been using Calibre for a couple of months. Great piece of software. But when I try to install the "search the internet plugin" it just fails saying

Code:
calibre, version 0.7.50
ERROR: Unhandled exception: <b>ZipImportError</b>:not a Zip file

Traceback (most recent call last):
  File "site-packages\calibre\gui2\preferences\plugins.py", line 285, in add_plugin
  File "site-packages\calibre\gui2\preferences\plugins.py", line 355, in check_for_add_to_toolbars
  File "<string>", line 70, in load_actual_plugin
  File "<string>", line 50, in get_base_module
ZipImportError: not a Zip file
I use Calibre 0.7.50, plugin version is 1.5.1, windows xp sp3. I have already tried to reinstall Calibre, but that didn't help. Any ideas what can be wrong, please?

Thanks for your answers
vladacr is offline   Reply With Quote
Old 03-24-2011, 06:11 AM   #2
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@vladcr - there have been a couple of people over the last few months who have posted here about that issue. Having not experienced it myself nor received enough detail from those who got it fixed I cannot say the exact cause, other than it does not appear to be related to a specific plugin. It sounds like some sort of corruption of your Calibre install.

Note that uninstalling and reinstalling Calibre by itself is not the same as a complete reinstall, because your local Calibre configuration directory containing your configuration files and plugins is not touched. This is a good thing when you are upgrading of course, but if the problem lies in one of those folders it won't disappear by just reinstalling Calibre itself.

If I can get a more definitive answer as to the cause I will put something in the sticky thread. Right now all I can suggest is the following:
  • Read the posts related to what the previous users have reported and tried in this thread. Loeffel did at least get their system back up and running again so you could work your way towards what they said worked in the last post though perhaps not quite as extreme as installing an earlier version. I don't believe the discussion in the other link I put in that thread pointing to the posts in Kindle Collections was closed out by the user reporting back.
  • Have you installed any other software on your PC recently? Perhaps there is some sort of conflict, Python related in particular. Try uninstalling that software to see if that makes a difference.
  • If you try the "complete clearout" route, make a copy of your Calibre configuration directory before deleting it (i.e. just rename it). I mean the folder that opens when you go to Preferences->Miscellaneous->Open calibre configuration directory. Then try starting Calibre without reinstalling it again and see if installing the plugin now works. If it does, at least that would tell us the problem lies in a corruption of your configuration directory, in which case try a comparison of them yourself or if unsure zip them up and post a link or PM me with it.
I would like to understand why it occurs to have an answer for any others, so if you are able to take a more diagnostic approach to solving it that would be great.
kiwidude is offline   Reply With Quote
Old 03-24-2011, 10:59 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,778
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Python's ZipImport is rather finicky about what zip files it will accept. It may be that you have some software on your system like an antivirus scanner that is altering the zip file when you download/open it, causing the zipimport to fail.

@kiwidude: You can verify/workaround this by unzipping the zip file and adding the folder it is unzipped into to sys.path instead, in your plugin.
kovidgoyal is offline   Reply With Quote
Old 03-24-2011, 12:56 PM   #4
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
Thanks for your replays, guys. I tried a complete wipeout, I uninstalled Calibre, deleted the "application data/calibre" directory, deleted all calibre related items in the register, installed Calibre again only to end up with the same error.

My antivirus SW was switched to off while downloading the plugin, and AFAIK Calibre is the only Python-related sw in my notebook.

I'm going to take the following ways:
1 - I will install Calibre in my Ubuntu system on the same NTB, if the plugin works, is there a way to copy some files to my Windows Calibre install directory?
2 - I will install an older version of Calibre and try installing the plugin there and then upgrade to latest Calibre.

Will let you know the results...
vladacr is offline   Reply With Quote
Old 03-24-2011, 01:27 PM   #5
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
Uninstalled the leates version. made a complete wipeout again. Installed version 0.46 of Calibre. Installed the plugin without the error. Restarted Calibre. No sign of the plugin in the menu, when I try to customize the plugin which seems to be installed, I get the error again!

calibre, version 0.7.46
ERROR: Unhandled exception: <b>ZipImportError</b>:not a Zip file

Traceback (most recent call last):
File "site-packages\calibre\gui2\preferences\plugins.py", line 260, in customize_plugin
File "site-packages\calibre\gui2\preferences\plugins.py", line 319, in modify_plugin
File "site-packages\calibre\customize\__init__.py", line 248, in is_customizable
File "<string>", line 67, in customization_help
File "<string>", line 56, in get_base_plugin
File "<string>", line 50, in get_base_module
ZipImportError: not a Zip file
vladacr is offline   Reply With Quote
Old 03-24-2011, 03:50 PM   #6
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
@vladcr - I am not sure what else to suggest, though your latest post intrigues me a little.

1. When you installed the plugin, did you get asked with a dialog about which menu/toolbar to add the plugin to?
2. If so, which did you choose, and did it appear on there when you restarted Calibre?
3. If it does not appear, if you start Calibre using calibre-debug -g do you see an error (or is that same error you see above)?

What I find interesting about your post above is if you do get to the point of being asked what menus/toolbars to add the plugin to when you install the plugin. If it does that, that means it has successfully "started up" the plugin from the zip file, because it needs to start the plugin to get information about which toolbars/menus the plugin is allowed to be added to if any. That it might load the plugin correctly at that point, but not after restarting Calibre, perhaps says something...

EDIT: I just realised you said you did this with 0.7.46. This would be before we added the feature to Calibre to prompt you for a menu/toolbar while installing a plugin. So not so meaningful after all. If you uninstall the plugin, upgrade to 0.7.50, then install the plugin, let me know what happens when you click install...

Last edited by kiwidude; 03-24-2011 at 04:03 PM.
kiwidude is offline   Reply With Quote
Old 03-24-2011, 05:10 PM   #7
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Also, can you attach to a post the plugin zip file you are trying to install from your machine, so I can do a comparison on it to see if I can detect any issue with it?
kiwidude is offline   Reply With Quote
Old 03-25-2011, 04:09 PM   #8
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
Well, I installed Calibre on the same machine, but in my Ubuntu partition, no problems, runs like a charm, plugin installed - everything ok.
Today I downloaded the latest version of Calibre for Windows, uninstalled the previous, made a wipeout, installed the latest version, downloaded the plugin again, tried to install the plugin. Ended with the error.

I attach the debug file as well as the plugin.
BTW is there an older version of the plugin available to download?
Attached Files
File Type: zip search_the_internet_plugin.zip (75.3 KB, 446 views)
File Type: txt tmpofjtco.txt (874 Bytes, 520 views)
vladacr is offline   Reply With Quote
Old 03-25-2011, 10:00 PM   #9
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Thanks for posting those. I did a binary diff on the zip file and it is identical to the one from my first post, so that confirms that nothing has tampered with it in the downloading process.

In terms of older versions available, no there isn't. All the versions since my significant rewrite of it have the same loading mechanism with multiple codefiles in the zip file, so an older version will make no difference. Nor will you be able to get virtually any of my other plugins here to work until you get this resolved.

Kovid has given me a suggestion for an alternate way to startup the plugin, involving it unzipping to a temporary directory while it runs and Calibre cleaning up afterwards. That is kind of a last resort brute force option though.

I've just taken a look at some Python source code for zipimport. It seems that particular error is thrown when there is an issue with how it slices up the path to the zip file. If indeed the code I am looking at is correct this might give us some clues. I am attaching a special build just for you with some additional debug statements to print out the plugin path information it is being given. Depending on what we see from that, I may give you another build or a separate test script to find out exactly what the failure is.

So download the attachment, try to install it while using calibre-debug -g, and let me know the output again.

EDIT: This is the source code I was looking at - perhaps Kovid or someone could tell me if this is indeed what would be called by Calibre as a result of "import zipimport".
http://svn.red-bean.com/bob/pyegg/tr...pyzipimport.py
As you can see from the code there is only one specific place this error is thrown from so it does look path related?
Attached Files
File Type: zip search_the_internet_plugin.zip (75.4 KB, 430 views)

Last edited by kiwidude; 03-25-2011 at 10:17 PM.
kiwidude is offline   Reply With Quote
Old 03-26-2011, 07:14 AM   #10
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
I tried to install the version you'd attached, the same error

Starting up...
Traceback (most recent call last):
File "site-packages\calibre\gui2\ui.py", line 107, in __init__
File "site-packages\calibre\gui2\ui.py", line 122, in init_iaction
File "<string>", line 70, in load_actual_plugin
File "<string>", line 50, in get_base_module
ZipImportError: not a Zip file
Started up in 2.8599998951
STI_plugin_path= D:/Stažené soubory/search_the_internet_plugin.zip
STI_plugin_path= C:\Documents and Settings\vlakuz\Data aplikací\calibre\plugins\
Search The Internet.zip
STI_about to zipimport: path= D:/Stažené soubory/search_the_internet_plugin.zip
Normpath= D:\Stažené soubory\search_the_internet_plugin.zip
Traceback (most recent call last):
File "site-packages\calibre\gui2\preferences\plugins.py", line 285, in add_plu
gin
File "site-packages\calibre\gui2\preferences\plugins.py", line 355, in check_f
or_add_to_toolbars
File "<string>", line 76, in load_actual_plugin
File "<string>", line 56, in get_base_module
ZipImportError: not a Zip file
vladacr is offline   Reply With Quote
Old 03-26-2011, 07:19 AM   #11
DoctorOhh
US Navy, Retired
DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.DoctorOhh ought to be getting tired of karma fortunes by now.
 
DoctorOhh's Avatar
 
Posts: 9,864
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
Quote:
Originally Posted by vladacr View Post
I tried to install the version you'd attached, the same error
As an experiment put the plugin in the root of D:\ and see if it makes a difference.
DoctorOhh is offline   Reply With Quote
Old 03-26-2011, 07:21 AM   #12
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
Oooh, very cool, thx for the output. I knew it would still fail as I changed no behaviour, but I wanted the output to see what.

I will do some experimentation myself, but could you try installing the zip from a folder that does not have accented characters in the name? Currently you are pulling it from D:\Stažené soubory\

EDIT: I see dwanthny posted at the same time with the same idea...

Last edited by kiwidude; 03-26-2011 at 07:25 AM.
kiwidude is offline   Reply With Quote
Old 03-26-2011, 07:37 AM   #13
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
Well, I moved the zip to the root of D: and started the installation. It worked, no error message, I was even offered to choose the menu items. Everything seemed fine. Restarted Calibre, but there is no "search the internet" item in none of the menus. When I go to plugins, find the plugin and click on "customize", then there goes the erroe again:

calibre, version 0.7.51
ERROR: Unhandled exception: <b>ZipImportError</b>:not a Zip file

Traceback (most recent call last):
File "site-packages\calibre\gui2\preferences\plugins.py", line 261, in customize_plugin
File "site-packages\calibre\gui2\preferences\plugins.py", line 321, in modify_plugin
File "site-packages\calibre\customize\__init__.py", line 248, in is_customizable
File "<string>", line 73, in customization_help
File "<string>", line 62, in get_base_plugin
File "<string>", line 56, in get_base_module
ZipImportError: not a Zip file
vladacr is offline   Reply With Quote
Old 03-26-2011, 07:43 AM   #14
kiwidude
calibre/Sigil 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,601
Karma: 2092290
Join Date: Oct 2010
Location: Australia
Device: Kindle Oasis
If you run Calibre using calibre-debug -g, post the output from that. I am pretty sure I know what it will say and where the problem lies. Your application data path also has an accented character within it (Data aplikací).

Give me a few moments to investigate this on my machine to confirm the issue and give you a workaround if possible.
kiwidude is offline   Reply With Quote
Old 03-26-2011, 07:50 AM   #15
vladacr
Member
vladacr began at the beginning.
 
Posts: 18
Karma: 34
Join Date: Mar 2011
Device: android
OK, here's the output. Have to say that this time I wasn't presented with the "menu" dialogue.

Starting up...
Started up in 1.0150001049
STI_plugin_path= D:/search_the_internet_plugin.zip
STI_plugin_path= C:\Documents and Settings\vlakuz\Data aplikací\calibre\plugins\
Search The Internet.zip
STI_about to zipimport: path= D:/search_the_internet_plugin.zip
Normpath= D:\search_the_internet_plugin.zip
vladacr is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Bad Zip file theducks Calibre 12 09-09-2018 09:58 AM
Renaming the otacerts.zip file...QQ Cpl Punishment Nook Developer's Corner 3 02-07-2011 08:14 PM
html file read as zip Newmarket2 Calibre 12 01-05-2011 03:17 PM
When download .epub file,it becomes .zip?? appstrading ePub 4 07-29-2010 02:21 PM
Mobileread Books in a ZIP file? Logseman Feedback 6 07-08-2010 04:45 PM


All times are GMT -4. The time now is 10:23 AM.


MobileRead.com is a privately owned, operated and funded community.