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

krop core dumps when attempting to crop a PDF #226012

Open
emmanuelrosa opened this issue Apr 13, 2023 · 4 comments
Open

krop core dumps when attempting to crop a PDF #226012

emmanuelrosa opened this issue Apr 13, 2023 · 4 comments
Labels
0.kind: bug Something is broken

Comments

@emmanuelrosa
Copy link
Contributor

Describe the bug

When attempting to crop a PDF with krop, it crashes with the message: PyPDF2.errors.DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.

Steps To Reproduce

  1. krop --grid=2x1 --go -o output.pdf input.pdf

Screenshots

If applicable, add screenshots to help explain your problem.

WARNING: Something got in our way
The following unexpected error has occured:

PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
Traceback (most recent call last):
  File "/nix/store/v2m75p3qaj3lq00chsicqxb8bf88kfn9-krop-0.6.0/lib/python3.10/site-packages/krop/mainwindow.py", line 450, in slotKrop
    raise err
  File "/nix/store/v2m75p3qaj3lq00chsicqxb8bf88kfn9-krop-0.6.0/lib/python3.10/site-packages/krop/mainwindow.py", line 414, in slotKrop
    pdf.loadFromFile(inputFileName)
  File "/nix/store/v2m75p3qaj3lq00chsicqxb8bf88kfn9-krop-0.6.0/lib/python3.10/site-packages/krop/pdfcropper.py", line 45, in loadFromFile
    self.loadFromStream(open(filename, "rb"))
  File "/nix/store/v2m75p3qaj3lq00chsicqxb8bf88kfn9-krop-0.6.0/lib/python3.10/site-packages/krop/pdfcropper.py", line 66, in loadFromStream
    self.reader = PdfFileReader(stream, strict=False)
  File "/nix/store/kz3rjc7dqhj0z2hmap2rx2fdqs5ki8x5-python3.10-PyPDF2-3.0.1/lib/python3.10/site-packages/PyPDF2/_reader.py", line 1974, in __init__
    deprecation_with_replacement("PdfFileReader", "PdfReader", "3.0.0")
  File "/nix/store/kz3rjc7dqhj0z2hmap2rx2fdqs5ki8x5-python3.10-PyPDF2-3.0.1/lib/python3.10/site-packages/PyPDF2/_utils.py", line 369, in deprecation_with_replacement
    deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
  File "/nix/store/kz3rjc7dqhj0z2hmap2rx2fdqs5ki8x5-python3.10-PyPDF2-3.0.1/lib/python3.10/site-packages/PyPDF2/_utils.py", line 351, in deprecation
    raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
Aborted (core dumped)

Expected behavior

I expected the input PDF to be cropped.

Notify maintainers

@leenaars

Metadata

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.2.8, NixOS, 23.05 (Stoat), 23.05.20230328.686ddd4`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.3`
 - nixpkgs: `/nix/store/lspbzb6zy39xa69in03sqqkm1w77bjnb-source`

@bquast
Copy link

bquast commented Jun 12, 2023

Have the same issue, anyone have an idea of a workaround on Arch Linux?

@bquast
Copy link

bquast commented Jun 12, 2023

I uninstalled pypdf2 v. 3.0.1 and installed pypdf (all smalls) 2.12.1, then it works

@jluttine
Copy link
Member

I suppose this is already fixed in krop but they just haven't made a release with the fix yet. See: arminstraub/krop#39

@emmanuelrosa
Copy link
Contributor Author

@leenaars, since upstream hasn't released an update with the commit which fixes this issue, would you consider updating the Nix package to use a commit as the version, rather than using the "0.6.0" tag?

You can probably use the current master as the commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

3 participants