From 92052e79d4138e66350d47ff3225eccca048a11b Mon Sep 17 00:00:00 2001 From: Eli Schwartz Date: Wed, 10 Apr 2019 13:29:55 -0400 Subject: [PATCH] py3: miscellaneous strings need to be marked as bytes --- src/calibre/ebooks/mobi/reader/mobi6.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/calibre/ebooks/mobi/reader/mobi6.py b/src/calibre/ebooks/mobi/reader/mobi6.py index 5a21510465..5910423855 100644 --- a/src/calibre/ebooks/mobi/reader/mobi6.py +++ b/src/calibre/ebooks/mobi/reader/mobi6.py @@ -79,17 +79,17 @@ class MobiReader(object): stream = open(filename_or_stream, 'rb') raw = stream.read() - if raw.startswith('TPZ'): + if raw.startswith(b'TPZ'): raise TopazError(_('This is an Amazon Topaz book. It cannot be processed.')) if raw.startswith(b'\xeaDRMION\xee'): raise KFXError() self.header = raw[0:72] - self.name = self.header[:32].replace('\x00', '') + self.name = self.header[:32].replace(b'\x00', b'') self.num_sections, = struct.unpack('>H', raw[76:78]) self.ident = self.header[0x3C:0x3C + 8].upper() - if self.ident not in ['BOOKMOBI', 'TEXTREAD']: + if self.ident not in [b'BOOKMOBI', b'TEXTREAD']: raise MobiError('Unknown book type: %s' % repr(self.ident)) self.sections = []