GithubHelp home page GithubHelp logo

Hang on viewing epub about epy HOT 5 OPEN

wustho avatar wustho commented on May 27, 2024
Hang on viewing epub

from epy.

Comments (5)

wustho avatar wustho commented on May 27, 2024

Wow, thanks for detailed traceback and solution suggestion, mate... Will look into that.

I just realized it should've been explicit zlib.error exception to catch...

from epy.

meganleewebb avatar meganleewebb commented on May 27, 2024

Unzip -t :

testing: mimetype                 OK
    testing: jacket.xhtml             OK
    testing: META-INF/container.xml   OK
    testing: OEBPS/9780062430052_toc.ncx   OK
    testing: OEBPS/9780062430052_content.opf   OK
    testing: OEBPS/images/cover.jpg   OK
    testing: OEBPS/images/auth.jpg    OK
    testing: OEBPS/images/copy.jpg    OK
    testing: OEBPS/images/copy1.jpg   OK
    testing: OEBPS/images/title.jpg   OK
    testing: OEBPS/images/heard.jpg   OK
    testing: OEBPS/imgbackad/imgbackad-1.jpg   OK
    testing: OEBPS/imgbackad/imgbackad-2.jpg   OK
    testing: OEBPS/styles/9780062430052_template.css   OK
    testing: OEBPS/text/titlepage.xhtml   OK
    testing: OEBPS/text/nav.xhtml     OK
    testing: OEBPS/text/About_the_Author.xhtml   OK
    testing: OEBPS/text/About_the_Publisher.xhtml   OK
    testing: OEBPS/text/9780062430052_Also_by.xhtml   OK
    testing: OEBPS/text/9780062430052_Credits.xhtml   OK
...

jacket.xhtml does exist in the epub.
First file accessed was titlepage.xhtml. jacket.xhtml was 2nd.

I didn't look further if the file path "OEBPS/../jacket.xhtml" should have been resolved prior to this function.

Thanks for great app. 👍

from epy.

wustho avatar wustho commented on May 27, 2024

Hey, there just fixed this with: 50dd4fa

Can you try upgrading epy (pip install --upgrade epy-reader) and let me know if the issue still persists. Thanks.

from epy.

meganleewebb avatar meganleewebb commented on May 27, 2024

That works.

I think your leaving a bug by not putting an upper limit on max_tries to exit the while True loop.

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 zlib.error as e:
                tries += 1
                if max_tries is not None and tries >= max_tries:
                    raise e

That will loop indefinitely on any zip error.

The comment:

# use try-except block to catch
# zlib.error: Error -3 while decompressing data: invalid distance too far back
# seems like caused by multiprocessing

Suggests the loop is there as more than one attempt is needed for that error. But some upper limit would seem wise.

I've not seen that error, but I have seen zip files that have one member corrupted and that member is unreadable, while the rest are.

from epy.

wustho avatar wustho commented on May 27, 2024

Oh, that's indeed wise idea! Putting it in TODO, thanks!

from epy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.