View Single Post
Old 01-14-2012, 07:58 AM   #150
Gary_M_Mugford has a complete set of Star Wars action figures.Gary_M_Mugford has a complete set of Star Wars action figures.Gary_M_Mugford has a complete set of Star Wars action figures.
Gary_M_Mugford's Avatar
Posts: 139
Karma: 297
Join Date: Jul 2010
Location: Brampton ON
Device: Kobo, Kindle3
Hi all,

Once again I have to parrot the sage advice of Jerry Pournelle. "I do the stupid things so you won't have to."

It's been awhile since I had to avail myself of the GenerateCovers plug-in. It didn't work. But I chalked it up to a new version and expected it to be corrected yesterday. It wasn't so I looked more carefully. The error message is located below:
calibre, version 0.8.35
ERROR: Unhandled exception: <b>IndexError</b>:list index out of range

Traceback (most recent call last):
File "calibre_plugins.generate_cover.action", line 48, in generate_cover
File "calibre_plugins.generate_cover.dialogs", line 912, in __init__
File "calibre_plugins.generate_cover.dialogs", line 1093, in display_preview
File "calibre_plugins.generate_cover.draw", line 195, in generate_cover_for_book
File "calibre_plugins.generate_cover.draw", line 44, in get_textline
File "calibre_plugins.generate_cover.draw", line 38, in get_font_or_default
IndexError: list index out of range

The key phrase was get_font. I had recently installed a utility to prune my font list (and get them back temporarily if I found myself wanting the 17th variation on a san serif font or the rarely used [by me] cyrillic font). Unfortunately, one of the things I pruned was that 17th variation of a san serif font that I had used in creating one of my cover variants. The Shadow Magazine variant.

And that waylaid the whole GenerateCovers plugin. I made two mistakes in trying to fix it.

The first was in trying to edit the Generate Cover.json file and replace each instance of the now non-existent font with Arial by visually scanning and replacing it as I saw it. Global Replace is your friend, use it. The second, was trying to edit the file while Calibre was open. Do. Not. Do. That.

A second try while Calibre wasn't running and using Global Replace was successful.

What lesson can be learned while watching me head off the cliff? Well, fiddling with fonts to keep them to a minimum is better in theory than in practice. Oh, and sticking to the traditional fonts for the book covers is a good idea too.
Gary_M_Mugford is offline   Reply With Quote