PdfReader is the PyPDF2 class for reading an existing PDF. It replaces PdfFileReader in PyPDF2 3.0.0, so older merging scripts may need this name changed. section 9.4.2
Updating a PDF-merging script
A report-merging function may create a reader for each report, inspect its pages, and pass them to a writer. If the script calls PdfFileReader under PyPDF2 3.0.0, it raises DeprecationError and identifies PdfReader as the replacement. section 9.4.2 section 9.4.1
Traceback (most recent call last):
File "merge_pdfs.py", line 34, in <module>
add_covers('reports', 'covers', 'final')
File "merge_pdfs.py", line 20, in add_covers
report_reader = PyPDF2.PdfFileReader(report) #1
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "...\PyPDF2\_reader.py", line 1974, in __init__
deprecation_with_replacement("PdfFileReader", "PdfReader", "3.0.0")
File "...\PyPDF2\_utils.py", line 369, in deprecation_with_replacement
deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
File "...\PyPDF2\_utils.py", line 351, in deprecation
raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileReader is #2
deprecated and was removed in PyPDF2 3.0.0. Use #2
PdfReader instead. #2
Trace the failure from the outdated constructor call to the recommended PdfReader replacement. section 9.4.2
