03-24-2011, 04:04 AM | #1 |
Member
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 Thanks for your answers |
03-24-2011, 06:11 AM | #2 |
Calibre Plugins Developer
Posts: 4,642
Karma: 2162064
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:
|
03-24-2011, 10:59 AM | #3 |
creator of calibre
Posts: 43,975
Karma: 22669822
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. |
03-24-2011, 12:56 PM | #4 |
Member
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... |
03-24-2011, 01:27 PM | #5 |
Member
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 |
03-24-2011, 03:50 PM | #6 |
Calibre Plugins Developer
Posts: 4,642
Karma: 2162064
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. |
03-24-2011, 05:10 PM | #7 |
Calibre Plugins Developer
Posts: 4,642
Karma: 2162064
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?
|
03-25-2011, 04:09 PM | #8 |
Member
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? |
03-25-2011, 10:00 PM | #9 |
Calibre Plugins Developer
Posts: 4,642
Karma: 2162064
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? Last edited by kiwidude; 03-25-2011 at 10:17 PM. |
03-26-2011, 07:14 AM | #10 |
Member
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 |
03-26-2011, 07:19 AM | #11 |
US Navy, Retired
Posts: 9,863
Karma: 13806776
Join Date: Feb 2009
Location: North Carolina
Device: Icarus Illumina XL HD, Nexus 7
|
|
03-26-2011, 07:21 AM | #12 |
Calibre Plugins Developer
Posts: 4,642
Karma: 2162064
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. |
03-26-2011, 07:37 AM | #13 |
Member
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 |
03-26-2011, 07:43 AM | #14 |
Calibre Plugins Developer
Posts: 4,642
Karma: 2162064
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. |
03-26-2011, 07:50 AM | #15 |
Member
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 |
|
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 |