View Full Version : Adding <guide> produces error: "Nonetype object has no attribute 'lower'

08-18-2011, 04:10 PM
I'm in the final stages of creating my first eBook from CS5.5 -- under the tutelage of Anne-Marie Concepcion's very fine course.

My exports to Kindle work fine. Exports to ePub work fine. Once I upzip my epub file, I've had no problem making changes (in Dreamweaver) to the html files and the template.css file or changing the date and adding the identifier to the content.opf file. I rezip, rename, and all is well.


But when I add a <guide> section to content.opf (as is necessary for Apple), I always get an error message when I try to open it in Calibre.The message is:

AttributeError: 'NoneType' object has no attribute 'lower' File "site-packages\calibre\ebooks\metadata\", line 992, in fget File "site-packages\calibre\ebooks\oeb\", line 229, in __enter__ File "", line 483, in run File "site-packages\calibre\gui2\viewer\", line 64, in runTraceback (most recent call last):
ERROR: Could not open ebook: 'NoneType' object has no attribute 'lower'calibre, version 0.8.14

I've tried only using just one of the reference lines in case there was a problem with one of the files, but no matter which one, it produces this message.

The code I added was:
<reference type=”cover” title=”Cover” href=”possibility_of_dreaming_cover.jpg”/>
<reference type=”title-page” title=”Title Page” href=”possibility_of_dreaming.html”/>
<reference type=”toc” title=”Table of Contents” href=”possibility_of_dreaming-4.html”/>
<reference type=”text” title=”text” href=” possibility_of_dreaming-5.html”/>

This may have nothing to do with it, but the "title" in those lines: what does this correspond to? Do I have to explicitly name items as "cover" "title page" "Table of Contents" and "text"? Or perhaps that isn't the issue at all.

Any help would be greatly appreciated
Thanks, Michael

08-19-2011, 05:31 AM
Where do you place exactly the <guide>? And do you use those (wrong) curly quotes or simple straight quotes "like these"?

The "title" attribute is what the reading software would display if it showed the guide items, but I don't know if any ePUB reader uses the guide, there's the NCX table of contents, after all.

Before opening the ePUB, try validating it with epubcheck and/or flightcrew.

08-19-2011, 07:39 PM
<reference type=”cover” title=”Cover” href=”possibility_of_dreaming_cover.jpg”/>

There's your problem. You need to refer to an OPS content document, i.e. an xhtml file. For Apple you'll also need to add a metadata element
<meta content="[id of cover image in the manifest]" name="cover" />

You can do all this easily in Sigil without having to edit the OPF by hand.