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

utils.PdfReadError ➔ errors.PdfReadError (Breaking Change in 1.27.6) #779

Closed
js-truework opened this issue Apr 19, 2022 · 3 comments · Fixed by #780
Closed

utils.PdfReadError ➔ errors.PdfReadError (Breaking Change in 1.27.6) #779

js-truework opened this issue Apr 19, 2022 · 3 comments · Fixed by #780
Assignees
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF

Comments

@js-truework
Copy link

Filing this so that others who update a patch version of the repo and wonder why some lines broke will be able to find it:

In 1.27.6, all errors were moved to PyPDF2.errors (in commit 1f0fbf3)

So if you were previously importing PdfReadError from PyPDF2.utils and are no longer able to, you need to change your import to get PdfReadError from PyPDF2.errors.

@js-truework js-truework added the is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF label Apr 19, 2022
@MartinThoma
Copy link
Member

Sorry 🙈 I haven't thought about the fact that people likely import it from there 🙈

I think I'll create another version which additionally exposes it in utils. However, with PyPDF2 2.0 I want to move it there as the public interface. So PyPDF2.errors is definitely the way to go.

@MartinThoma MartinThoma changed the title PdfReadError Breaking Change in 1.27.6 utils.PdfReadError ➔ errors.PdfReadError (Breaking Change in 1.27.6) Apr 19, 2022
@MartinThoma
Copy link
Member

I'm very sorry for the breaking change. I've just released 1.27.7 with #780 that imports the Exceptions in utils so that peoples code will not break.

However, I do not explicitly re-export it from utils. I still want the exceptions to live in PyPDF2.errors on the long run. This is just a patch to avoid setups to break. Depending on the CI people might still get notes that they are using an implict export (mypy --no-implicit-reexport)

@js-truework
Copy link
Author

Hey Martin, Saw you recently took over this project from Will McGugan's twitter thread/retweet. Glad to see you're picking up the project and taking care of it. Breaking changes happen, especially when adopting new projects. Wasn't trying to place any blame here or anything, just wanted to make sure others had something they could find if they updated wondered why something was breaking. Sounds like your solution in #780 is a good solution for the short term. I agree that it makes much more sense long term to house them in the errors module :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is-bug From a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants