View Single Post
Old 07-12-2014, 01:24 AM   #896
tkeo
Connoisseur
tkeo began at the beginning.
 
Posts: 94
Karma: 10
Join Date: Feb 2014
Location: Japan
Device: Kindle PaperWhite, Kobo Aura HD
Hi,

In the Calibre KindleUnpack Plugin thread, an error is reported.
https://www.mobileread.com/forums/sho...&postcount=215
https://www.mobileread.com/forums/sho...&postcount=225
Quote:
calibre, version 1.43.0
ERROR: KindleUnpack - The Plugin v0.67.0: cannot fit 'long' into an index-sized integer

Traceback (most recent call last):
File "calibre_plugins.kindleunpack_plugin.extractio n", line 192, in unpack_ebook
File "calibre_plugins.kindleunpack_plugin.utilities ", line 283, in unpackMOBI
File "calibre_plugins.kindleunpack_plugin.kindleunp ack. kindleunpack", line 1638, in unpackBook
File "calibre_plugins.kindleunpack_plugin.kindleunp ack. kindleunpack", line 1335, in process_all_mobi_headers
IndexError: cannot fit 'long' into an index-sized integer
Quote:
calibre, version 1.44.0
ERROR: KindleUnpack - The Plugin v0.72.1: cannot fit 'long' into an index-sized integer

Traceback (most recent call last):
File "calibre_plugins.kindleunpack_plugin.extractio n", line 192, in unpack_ebook
File "calibre_plugins.kindleunpack_plugin.utilities ", line 283, in unpackMOBI
File "calibre_plugins.kindleunpack_plugin.kindleunp ack. kindleunpack", line 895, in unpackBook
File "calibre_plugins.kindleunpack_plugin.kindleunp ack. kindleunpack", line 805, in process_all_mobi_headers
File "calibre_plugins.kindleunpack_plugin.kindleunp ack. kindleunpack", line 168, in renameCoverImage
IndexError: cannot fit 'long' into an index-sized integer
In my guees, the cause of the error is that CoverOffset EXTH value is the out of range of int. I think It is possible to be fixed by replacing,

Code:
i = int(metadata['CoverOffset'][0])
if imgnames[i] is not None:
to
Code:
i = int(metadata['CoverOffset'][0])
if i >= 0 and i < len(imgnames) and imgnames[i] is not None:
and
Code:
imageNumber = int(metadata['CoverOffset'][0])
cover_image = self.imgnames[imageNumber]
to
Code:
imageNumber = int(metadata['CoverOffset'][0])
if imageNumber >= 0 and self.imageNumber < len(self.imgnames):
    cover_image = imgnames[imageNumber]
Reported versions are v0.67 and v0.72.1(core version v.72a); however, perhaps the latest version have same codes.
I will post fixed test version to the Calibre Plugin thread to see it work or not.

I am no idea why CoverOffset EXTH has such a value. Is is needed to be fixed in the latest version?

Thanks,
tkeo is offline   Reply With Quote