Filimoa / open-parse

Improved file parsing for LLM’s
https://filimoa.github.io/open-parse/
MIT License
2.34k stars 89 forks source link

TypeError: Rect.__init__() got an unexpected keyword argument 'x0' #4

Closed Noexpert closed 5 months ago

Noexpert commented 5 months ago

When trying to display document nodes, I get the following error message. I tried it with different pdf files.

Thanks

>>> pdf = openparse.Pdf(basic_doc_path)
>>> pdf.display_with_bboxes(
...     parsed_basic_doc.nodes,
... )
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/boss/.local/lib/python3.11/site-packages/openparse/pdf.py", line 152, in display_with_bboxes
    marked_up_doc = self._draw_bboxes(flattened_bboxes, nodes[0]._coordinates)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/boss/.local/lib/python3.11/site-packages/openparse/pdf.py", line 128, in _draw_bboxes
    rect = fitz.Rect(x0=bbox.x0, y0=bbox.y0, x1=bbox.x1, y1=bbox.y1)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: Rect.__init__() got an unexpected keyword argument 'x0'
Filimoa commented 5 months ago

Thanks for opening an issue.

Issue should be resolved with the latest release v0.3.1. Looks like PyMuPDF only added kwargs to Rect recently.