Skip to content

Unbound local variable 'word_id' in ocr convertor #1103

Description

@DianaPrs

Deepseek and Paddle OCR converters return the error on some pages

{
  "message": "cannot access local variable 'word_id' where it is not associated with a value",
  "stackTrace": "  File \"/app/badgerdoc_ocr_paddle/.venv/lib/python3.12/site-packages/temporalio/worker/_activity.py\", line 318, in _handle_start_activity_task\n    result = await self._execute_activity(\n             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/app/badgerdoc_ocr_paddle/.venv/lib/python3.12/site-packages/temporalio/worker/_activity.py\", line 669, in _execute_activity\n    return await impl.execute_activity(input)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/app/badgerdoc_ocr_paddle/.venv/lib/python3.12/site-packages/temporalio/worker/_activity.py\", line 864, in execute_activity\n    return await input.fn(*input.args)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/app/badgerdoc_ocr_paddle/badgerdoc_ocr_paddle/activities/ocr_convertors.py\", line 441, in paddle_ocr_results_to_hocr\n    hocr_lines.extend(_blocks_to_hocr(page_number, all_blocks))\n                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n\n  File \"/app/badgerdoc_ocr_paddle/badgerdoc_ocr_paddle/activities/ocr_convertors.py\", line 344, 
in _blocks_to_hocr\n    
page_number, line_text, x0, ly0, x1, ly1, line_id, word_id\n                                                       ^^^^^^^\n",
  "applicationFailureInfo": {
    "type": "UnboundLocalError"
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    back-endbugSomething isn't working

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions