Skip to content

ModuleNotFoundError issue with PyPDF2==2.10.1 #1242

Closed
@JaMe76

Description

@JaMe76

When importing

from PyPDF2 import PdfFileReader, PdfFileWriter

I get an immediate error

Traceback (most recent call last):
  File "~/dummy.py", line 21, in <module>
    from PyPDF2 import PdfFileReader, PdfFileWriter
  File "~/venv/lib/python3.8/site-packages/PyPDF2/__init__.py", line 10, in <module>
    from ._encryption import PasswordType
  File "~/venv/lib/python3.8/site-packages/PyPDF2/_encryption.py", line 36, in <module>
    from PyPDF2.generic import (
ModuleNotFoundError: No module named 'PyPDF2.generic'

This occurs with the latest

pip install PyPDF2==2.10.1

The older version works as expected:

pip install PyPDF2==2.10.0

Environment

Which environment were you using when you encountered the problem?

$ python -m platform
Linux-5.15.0-46-generic-x86_64-with-glibc2.29

$ python -c "import PyPDF2;print(PyPDF2.__version__)"
File "<string>", line 1, in <module>
  File "~/venv/lib/python3.8/site-packages/PyPDF2/__init__.py", line 10, in <module>
    from ._encryption import PasswordType
  File "~/venv/lib/python3.8/site-packages/PyPDF2/_encryption.py", line 36, in <module>
    from PyPDF2.generic import (
ModuleNotFoundError: No module named 'PyPDF2.generic'

Code + PDF

from PyPDF2 import PdfFileReader, PdfFileWriter

Share here the PDF file(s) that cause the issue. The smaller they are, the
better. Let us know if we may add them to our tests! -> No PDF required

Traceback

This is the complete Traceback I see:

 File "<string>", line 1, in <module>
 File "~/venv/lib/python3.8/site-packages/PyPDF2/__init__.py", line 10, in <module>
 from ._encryption import PasswordType
 File "~/venv/lib/python3.8/site-packages/PyPDF2/_encryption.py", line 36, in <module>
 from PyPDF2.generic import (
ModuleNotFoundError: No module named 'PyPDF2.generic'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions