I bought the latest Diana Gabaldon book from Shortcovers.com in epub, and try to read it in Calibre. When trying to view, the following error comes up. DRM-disinfecting software also produces the same error. Does anyone know what the root cause of this is (in non-developer English please - I don't fully understand the error message) and if it can be fixed?

Interestingly, ADE and my Sony can open and read the file just fine.

The error is:
Traceback (most recent call last):
File "/Applications/calibre.app/Contents/console.app/Contents/Resources/lib/python2.6/site-packages.zip/calibre/gui2/viewer/main.py", line 59, in run
Thread.run(self)
File "threading.pyo", line 477, in run
File "calibre/ebooks/oeb/iterator.pyo", line 140, in __enter__
File "calibre/customize/conversion.pyo", line 208, in __call__
File "calibre/ebooks/epub/input.pyo", line 106, in convert
File "calibre/utils/zipfile.pyo", line 1013, in extractall
File "calibre/utils/zipfile.pyo", line 1001, in extract
File "calibre/utils/zipfile.pyo", line 1039, in _extract_member
File "calibre/utils/zipfile.pyo", line 949, in open
BadZipfile: File name in directory "OEBPS/Ga" id="f035" media-type="image/jp" and header "OEBPS/Gaba_9780307372338_epub_c79_r1.htm" differ.

Calibre does not support DRM. So trying to view it with Calibre's viewer will not work.

As for removing DRM, I have no idea what the issue is.

I guess I wasn't very clear. I know that Calibre doesn't support drm, but the interesting thing is that with this file, it gives the error even prior to the drm message that you would usually get, which suggests to me an issue with the epub file (?container) itself. I don't know enough about the different epub standards to know why it might work with ADE/Sony, but not other programs, or what this error truly means in terms of the structure of the file/container.

The issue is that there are some ePubs are made with a directory that is invalidly named and when the script tries to write out this directory, it fails. The solution is to get this directory out of the ePub file. ZIP would fix it. Another way is to extract all the other files/directories and then remake the ePub without the invalid directories. Then run the script to remove the DRM and you should be good to go.

Is there anyone out there good enough to fix the script to deal with this issue on the fly? Do we think this is a purposeful attempt to nix the script, or is this just sloppy epub making? Why is ADE OK with this?

Is there anyone out there good enough to fix the script to deal with this issue on the fly? Do we think this is a purposeful attempt to nix the script, or is this just sloppy epub making? Why is ADE OK with this?

ADE is OK with that because there is nothing referencing those directories so ADE just ignores them.

I've had similar issues with several epub books. I think that the zlib library used by python (and maybe Calibre?) is having trouble unzipping certain epubs.

I was able to fix the issue by unzipping the original file using the built in decompression program in OSX (rename the file from mybook.epub to mybook.zip and double click on it). I forget what I used in Windows... it might have been the built in program, or maybe WinZip. I avoided using the command line unzip which uses the zlib library.

Then I just rezipped it using the command line zip (or, on Windows, the cygwin version of zip):