Skip unreadable pages during PDF extraction instead of failing the whole book#1398
Open
NilsLeo wants to merge 1 commit into
Open
Skip unreadable pages during PDF extraction instead of failing the whole book#1398NilsLeo wants to merge 1 commit into
NilsLeo wants to merge 1 commit into
Conversation
When PyMuPDF raised while rendering or extracting a single page, the exception propagated out of the worker Pool and often could not be pickled (SwigPyObject), so the whole job died with an opaque pickling TypeError instead of the real cause. Catch per-page errors, skip the offending page and continue, so a PDF with a few bad pages still converts.
Collaborator
|
Do you have a small sample example PDF file for failing rendering and any other relevant examples for other PRs? |
Contributor
Author
|
Yes, quite busy atm, but will try to provide relevant examples for each bug ie the applied settings and the file which triggered the exception |
Collaborator
|
I guess I'm more interested in the exact underlying error messages (sometimes kcc hides the underlying error since error handling isn't the best) |
NilsLeo
added a commit
to NilsLeo/kcc
that referenced
this pull request
Jul 24, 2026
Revert the render_page/extract_page per-page try/except skip so master no longer carries the pdf-page-resilience fix (that change lives on up/pdf-page-resilience / PR ciromattia#1398). Lets master reproduce the original per-page PDF failure for A/B testing. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When PyMuPDF raises while rendering or extracting a single page, the exception propagates out of the worker
Pooland often cannot be pickled (SwigPyObject), so the entire job dies with an opaqueTypeErrorabout pickling instead of the real cause. A PDF with a handful of bad pages fails completely even though every other page is fine.This catches per-page errors inside the worker, logs a warning, skips the offending page and continues — so the book still converts, and genuine failures surface with a clear message rather than a masked pickling error.