diff --git a/src/calibre/ebooks/mobi/writer8/skeleton.py b/src/calibre/ebooks/mobi/writer8/skeleton.py index 1fab295273..286083331c 100644 --- a/src/calibre/ebooks/mobi/writer8/skeleton.py +++ b/src/calibre/ebooks/mobi/writer8/skeleton.py @@ -16,7 +16,7 @@ from lxml import etree from calibre import my_unichr from calibre.ebooks.oeb.base import XHTML_NS, extract from calibre.ebooks.mobi.utils import to_base, PolyglotDict -from polyglot.builtins import iteritems, unicode_type +from polyglot.builtins import iteritems, unicode_type, as_bytes CHUNK_SIZE = 8192 @@ -397,7 +397,7 @@ class Chunker(object): pos, fid = to_base(pos, min_num_digits=4), to_href(fid) return ':off:'.join((pos, fid)).encode('utf-8') - placeholder_map = {k:to_placeholder(v) for k, v in + placeholder_map = {as_bytes(k):to_placeholder(v) for k, v in iteritems(self.placeholder_map)} # Now update the links