ragflow/rag/app
Jay Xu 7f08ba47d7
Fix "no tc element at grid_offset" (#9375)
### What problem does this PR solve?

fix "no `tc` element at grid_offset", just log warning and ignore.
stacktrace:
```
Traceback (most recent call last):
  File "/ragflow/rag/svr/task_executor.py", line 620, in handle_task
    await do_handle_task(task)
  File "/ragflow/rag/svr/task_executor.py", line 553, in do_handle_task
    chunks = await build_chunks(task, progress_callback)
  File "/ragflow/rag/svr/task_executor.py", line 257, in build_chunks
    cks = await trio.to_thread.run_sync(lambda: chunker.chunk(task["name"], binary=binary, from_page=task["from_page"],
  File "/ragflow/.venv/lib/python3.10/site-packages/trio/_threads.py", line 447, in to_thread_run_sync
    return msg_from_thread.unwrap()
  File "/ragflow/.venv/lib/python3.10/site-packages/outcome/_impl.py", line 213, in unwrap
    raise captured_error
  File "/ragflow/.venv/lib/python3.10/site-packages/trio/_threads.py", line 373, in do_release_then_return_result
    return result.unwrap()
  File "/ragflow/.venv/lib/python3.10/site-packages/outcome/_impl.py", line 213, in unwrap
    raise captured_error
  File "/ragflow/.venv/lib/python3.10/site-packages/trio/_threads.py", line 392, in worker_fn
    ret = context.run(sync_fn, *args)
  File "/ragflow/rag/svr/task_executor.py", line 257, in <lambda>
    cks = await trio.to_thread.run_sync(lambda: chunker.chunk(task["name"], binary=binary, from_page=task["from_page"],
  File "/ragflow/rag/app/naive.py", line 384, in chunk
    sections, tables = Docx()(filename, binary)
  File "/ragflow/rag/app/naive.py", line 230, in __call__
    while i < len(r.cells):
  File "/ragflow/.venv/lib/python3.10/site-packages/docx/table.py", line 438, in cells
    return tuple(_iter_row_cells())
  File "/ragflow/.venv/lib/python3.10/site-packages/docx/table.py", line 436, in _iter_row_cells
    yield from iter_tc_cells(tc)
  File "/ragflow/.venv/lib/python3.10/site-packages/docx/table.py", line 424, in iter_tc_cells
    yield from iter_tc_cells(tc._tc_above)  # pyright: ignore[reportPrivateUsage]
  File "/ragflow/.venv/lib/python3.10/site-packages/docx/oxml/table.py", line 741, in _tc_above
    return self._tr_above.tc_at_grid_offset(self.grid_offset)
  File "/ragflow/.venv/lib/python3.10/site-packages/docx/oxml/table.py", line 98, in tc_at_grid_offset
    raise ValueError(f"no `tc` element at grid_offset={grid_offset}")
ValueError: no `tc` element at grid_offset=10
```

### Type of change

- [x] Bug Fix (non-breaking change which fixes an issue)
2025-08-11 17:13:10 +08:00
..
__init__.py Update comments (#4569) 2025-01-21 20:52:28 +08:00
audio.py Update comments (#4569) 2025-01-21 20:52:28 +08:00
book.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
email.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
laws.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
manual.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
naive.py Fix "no tc element at grid_offset" (#9375) 2025-08-11 17:13:10 +08:00
one.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
paper.py Feat: Redesign and refactor agent module (#9113) 2025-07-30 19:41:09 +08:00
picture.py Feat: add image preview to retrieval test. (#7610) 2025-05-13 14:30:36 +08:00
presentation.py Fix: PlainParser using fix in presentation (#9239) 2025-08-05 17:48:18 +08:00
qa.py Fix: Solve the OOM issue when passing large PDF files while using QA chunking method. (#8464) 2025-06-25 10:25:45 +08:00
resume.py Update comments (#4569) 2025-01-21 20:52:28 +08:00
table.py Fix:Better Support Table Value Type (#8822) 2025-07-14 17:51:26 +08:00
tag.py Error storing tag in Redis (#7541) 2025-05-09 10:17:09 +08:00