hellerbarde / stapler

A small utility making use of the pypdf library to provide a (somewhat) lighter alternative to pdftk
Other
283 stars 53 forks source link

Fails tests - No module named 'PyPDF2.pdf' #90

Open benkohler opened 2 years ago

benkohler commented 2 years ago

Building from a snapshot from March 30, stapler is failing tests. It looks like "from PyPDF2.pdf" should be "from PyPDF2". Are some other distros installing it as PyPDF2.pdf? None that I can see, but maybe.

====================================================================== ERROR: staplelib.tests (unittest.loader._FailedTest)

ImportError: Failed to import test module: staplelib.tests Traceback (most recent call last): File "/usr/lib/python3.9/unittest/loader.py", line 436, in _find_test_path module = self._get_module_from_name(name) File "/usr/lib/python3.9/unittest/loader.py", line 377, in _get_module_from_name import(name) File "/var/tmp/portage/dev-python/stapler-1.0.0_p20220330/work/stapler-382f1edc62296e071093a5419811a2fca9d78d93/staplelib/tests.py", line 8, in from PyPDF2.pdf import PdfFileReader ModuleNotFoundError: No module named 'PyPDF2.pdf'


Ran 1 test in 0.000s

FAILED (errors=1)

benkohler commented 1 year ago

https://github.com/py-pdf/pypdf/commit/4b069dd94a30efa2aef09e779be74e165d3a5a00

So as of 2.0.0, it should be PyPDF2. It changes again in 3.1.0 (very new release), you will need "from pypdf"