Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent overwriting of the warnings by PyPDF2 #20169

Closed
wants to merge 2 commits into from

Conversation

jll-02
Copy link
Contributor

@jll-02 jll-02 commented Feb 27, 2023

When creating an Object of the class PDFFileReader from the package PyPDF2 the global warning function will be overwritten. This definitely happens in version 13, since it uses PyPDF2 in version 1.26.0 where it is done by the standard.

This causes problems e.g. in unit tests when warnings are being thrown since some part of the handling in the PDFFileReader warning is incompatible with other warnings and causes an error.

However, there is a simple solution to this because the constructor of the PDFFileReader accepts an argument to skip the overwriting of the warnings.

This problem is also known to PyPDF2 and also fixed in version 2 of PyPDF. Since frappe version 13 uses version 1.26.0 of PyPDF2 it is necessary to adapt to this problem.

For more information on PyPDF2 site check the following issue in their repository: py-pdf/pypdf#67

In this issue there is also stated that the argument for the constructor is the correct and best way to solve this problem.

PyPDF2 overwrites the warning function which causes a follow-up problem where warnings can not be displayed
PyPDF2 overwrites the warning function which causes a follow-up problem where warnings can not be displayed
@jll-02 jll-02 requested a review from a team as a code owner February 27, 2023 11:12
@jll-02 jll-02 requested review from shariquerik and removed request for a team February 27, 2023 11:12
@jll-02 jll-02 changed the base branch from develop to version-13-hotfix February 27, 2023 11:33
@jll-02 jll-02 changed the base branch from version-13-hotfix to develop February 27, 2023 11:34
@jll-02 jll-02 closed this Feb 27, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant