diff --git a/src/calibre/ebooks/mobi/debug/headers.py b/src/calibre/ebooks/mobi/debug/headers.py index 308d7c262b..ef4fe8f6eb 100644 --- a/src/calibre/ebooks/mobi/debug/headers.py +++ b/src/calibre/ebooks/mobi/debug/headers.py @@ -6,14 +6,14 @@ __license__ = 'GPL v3' __copyright__ = '2012, Kovid Goyal ' __docformat__ = 'restructuredtext en' -import struct, datetime, os, numbers +import struct, datetime, os, numbers, binascii from calibre.utils.date import utc_tz from calibre.ebooks.mobi.reader.headers import NULL_INDEX from calibre.ebooks.mobi.langcodes import main_language, sub_language from calibre.ebooks.mobi.debug import format_bytes from calibre.ebooks.mobi.utils import get_trailing_data -from polyglot.builtins import as_bytes, iteritems, range, unicode_type +from polyglot.builtins import iteritems, range, unicode_type # PalmDB {{{ @@ -210,7 +210,7 @@ class EXTHRecord(object): else: self.data, = struct.unpack(b'>L', self.data) elif self.type in {209, 300}: - self.data = as_bytes(self.data.encode('hex')) + self.data = binascii.hexlify(self.data) def __str__(self): return '%s (%d): %r'%(self.name, self.type, self.data)