Skip to content

Recursion Error when outputting merged PDF File #268

@jeffreycentex

Description

@jeffreycentex

I have a script that basically combines files into one PDF. Normally it works properly, but the last few days I have had the following failure and don't know where to start:

Uncaught exception
Traceback (most recent call last):
File "C:\gitlab\payerpath\payerpath-combine.py", line 130, in
mergedfile.write(outputfile)
File "C:\Anaconda\lib\site-packages\PyPDF2\merger.py", line 230, in write
self.output.write(fileobj)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 482, in write
self._sweepIndirectReferences(externalReferenceMap, self._root)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 571, in _sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 547, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 571, in _sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 547, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)

---- repeat the last 4 lines about 700 times ---

File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 547, in _sweepIndirectReferences
value = self._sweepIndirectReferences(externMap, value)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 571, in _sweepIndirectReferences
self._sweepIndirectReferences(externMap, realdata)
File "C:\Anaconda\lib\site-packages\PyPDF2\pdf.py", line 552, in _sweepIndirectReferences
data[key] = value
File "C:\Anaconda\lib\site-packages\PyPDF2\generic.py", line 502, in setitem
if not isinstance(key, PdfObject):
RuntimeError: maximum recursion depth exceeded in instancecheck

No other errors.

Any hidden setting that could help with this one?

Metadata

Metadata

Assignees

No one assigned

    Labels

    PdfMergerThe PdfMerger component is affectedis-bugFrom a users perspective, this is a bug - a violation of the expected behavior with a compliant PDF

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions