Skip to content

PDF文件翻译失败 #25

@cycmars

Description

@cycmars

AttributeError: 'PDFPageInterpreterEx' object has no attribute 'ncs'
2025-06-19 06:16:05,606 - babeldoc.progress_monitor - INFO - progress_monitor handle translate_error: 'PDFPageInterpreterEx' object has no attribute 'ncs'
2025-06-19 06:16:05,607 - babeldoc.high_level - INFO - Waiting for translation to finish...
2025-06-19 06:16:05,617 - babeldoc.translation_config - INFO - cleanup temp files: /tmp/tmpzt7hou19
2025-06-19 06:16:05,618 - asyncio - ERROR - Future exception was never retrieved
future: <Future finished exception=AttributeError("'PDFPageInterpreterEx' object has no attribute 'ncs'")>
Traceback (most recent call last):
File "/usr/local/lib/python3.11/concurrent/futures/thread.py", line 58, in run
result = self.fn(*self.args, **self.kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/babeldoc/high_level.py", line 388, in do_translate
result = _do_translate_single(pm, translation_config)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/babeldoc/high_level.py", line 579, in _do_translate_single
start_parse_il(
File "/usr/local/lib/python3.11/site-packages/babeldoc/high_level.py", line 199, in start_parse_il
ops_base = interpreter.process_page(page)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/babeldoc/pdfinterp.py", line 338, in process_page
ops_base = self.render_contents(page.resources, page.contents, ctm=ctm)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/babeldoc/pdfinterp.py", line 370, in render_contents
return self.execute(list_value(streams))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/usr/local/lib/python3.11/site-packages/babeldoc/pdfinterp.py", line 431, in execute
func(*args)
File "/usr/local/lib/python3.11/site-packages/pdfminer/pdfinterp.py", line 1127, in do_Tj
self.do_TJ([s])
File "/usr/local/lib/python3.11/site-packages/babeldoc/pdfinterp.py", line 391, in do_TJ
assert self.ncs is not None
^^^^^^^^
AttributeError: 'PDFPageInterpreterEx' object has no attribute 'ncs'
2025-06-19 06:16:05,619 - babeldoc.document_il.translator.translator - INFO - openai translate call count: 0
2025-06-19 06:16:05,619 - babeldoc.document_il.translator.translator - INFO - openai translate cache call count: 0
2025-06-19 06:16:05,630 - app.translate.pdf - ERROR - PDF任务初始化失败: PDF翻译过程失败

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions