I'm running into a TypeError when translating certain PDFs. It seems to be triggered by specific pages (likely due to links or metadata), but the rest of the document translates fine if I remove the problematic page.
File "C:\test\.venv\Lib\site-packages\argostranslatefiles\formats\pdf.py", line 18, in translate
translator.translate_pdf()
File "C:\test\.venv\Lib\site-packages\argostranslatefiles\formats\pdf.py", line 56, in translate_pdf
self._apply_translations_to_pdf()
File "C:\test\.venv\Lib\site-packages\argostranslatefiles\formats\pdf.py", line 200, in _apply_translations_to_pdf
self._insert_styled_text_blocks(page, normal_blocks, is_bold=False)
File "C:\test\.venv\Lib\site-packages\argostranslatefiles\formats\pdf.py", line 224, in _insert_styled_text_blocks
elif link_info.get("page", -1) >= 0:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: '>=' not supported between instances of 'str' and 'int'
Applying this temporary fix allowed the translation to complete:
elif int(link_info.get("page", -1)) >= 0:
I'm opening this as an issue, as I am not certain if this fix will break anything else.
I'm attaching a file that reproduces the issue: bad.pdf
I'm running into a
TypeErrorwhen translating certain PDFs. It seems to be triggered by specific pages (likely due to links or metadata), but the rest of the document translates fine if I remove the problematic page.Applying this temporary fix allowed the translation to complete:
I'm opening this as an issue, as I am not certain if this fix will break anything else.
I'm attaching a file that reproduces the issue: bad.pdf