py3: Fix spurious warning when reading EPUB metadata

This commit is contained in:
Kovid Goyal 2019-04-10 15:10:28 +05:30
parent 46b9a7a325
commit dce8ea7719
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -92,11 +92,11 @@ class OCFReader(OCF):
def __init__(self): def __init__(self):
try: try:
mimetype = self.open('mimetype').read().rstrip() mimetype = self.open('mimetype').read().decode('utf-8').rstrip()
if mimetype != OCF.MIMETYPE: if mimetype != OCF.MIMETYPE:
print('WARNING: Invalid mimetype declaration', mimetype) print('WARNING: Invalid mimetype declaration', mimetype)
except: except:
print('WARNING: Epub doesn\'t contain a mimetype declaration') print('WARNING: Epub doesn\'t contain a valid mimetype declaration')
try: try:
with closing(self.open(OCF.CONTAINER_PATH)) as f: with closing(self.open(OCF.CONTAINER_PATH)) as f: