Open
Description
Version: v2022.2.14
epy loads the epub file, but hangs after the first page.
Problem is in (734-754):
def get_raw_text(self, content_path: Union[str, ET.Element]) -> str:
assert isinstance(self.file, zipfile.ZipFile)
assert isinstance(content_path, str)
max_tries: Optional[int] = None # 1 if DEBUG else None
# use try-except block to catch
# zlib.error: Error -3 while decompressing data: invalid distance too far back
# seems like caused by multiprocessing
tries = 0
while True:
try:
content = self.file.open(content_path).read()
break
except Exception as e:
tries += 1
if max_tries is not None and tries >= max_tries:
raise e
return content.decode("utf-8")
when it is passed a content_path with value: "OEBPS/../jacket.xhtml"
self.file.open(content_path)
errors with There is no item named 'OEBPS/../jacket.xhtml' in the archive"
The try/except catches the error.
max_tries = None
The while loop never exits.
My quick fix has been to set max_tries = 2
and add:
content_path=os.path.relpath(content_path)
after the tries += 1
line.
Metadata
Metadata
Assignees
Labels
No labels