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

Filename issue in formatWarning method in utils.py #641

Closed
wants to merge 2 commits into from

Conversation

louisgregg
Copy link

@louisgregg louisgregg commented Oct 8, 2021

I have created a pull request to address the IndexError which arises when formatWarning() in utils.py is passed a filename string that doesn't contain a / or \\ character. I simply implemented @CrimsonZen's suggestion of replacing:
file = filename.replace("/","\\").rsplit("\\",1)[1] # find the file name
with
file = filename.replace("/","\\").rsplit("\\",1).pop() # find the file name

Hopefully this can be merged into the main branch at some point. This error arises because PyPDF2 overwrites warnings.formatwarning (issue #67). However, this pull request does not address the issue directly.

mlissner added a commit to freelawproject/courtlistener that referenced this pull request Mar 23, 2022
In the following issues and PRs, PyPDF2 users have identified and
offered to fix a weird bug where the library overrides normal logging
in a way that breaks when you log certain things:

py-pdf/pypdf#67
py-pdf/pypdf#641
py-pdf/pypdf#452
py-pdf/pypdf#243

Not great, but there was probably a reason. Unfortunately, the
maintainers aren't merging any of the fixes people have provided
over the years, and when I upgraded to Python 3.10 one of our tests
changed in a way that it triggered this bug.

So, since the maintainers don't seem inclined to fix their own
package, this commit yanks it from CourtListener. It's good timing,
really, since we now have the microservice available, but it was
disappointing to see bugs and PRs related to this going back to 2014.
Most of the fixes are one or two-line PRs too. Bummer.
@MartinThoma
Copy link
Member

Thank you for your contribution!

This issue was fixed in another PR which I just merged

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants