Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: 'Bbox' object is not subscriptable #26

Closed
simjak opened this issue Jan 10, 2025 · 2 comments
Closed

TypeError: 'Bbox' object is not subscriptable #26

simjak opened this issue Jan 10, 2025 · 2 comments

Comments

@simjak
Copy link
Contributor

simjak commented Jan 10, 2025

I was running the

text_from_pdf: str = plain_text_output(
            pdf_path=str(pdf_file), sort=True, hyphens=True
        )
  File "src/embeddings.py", line 53, in <module>
    text_from_pdf: str = plain_text_output(
                         ~~~~~~~~~~~~~~~~~^
        pdf_path=str(pdf_file), sort=True, hyphens=True
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    )
    ^
  File ".venv/lib/python3.13/site-packages/pdftext/extraction.py", line 68, in plain_text_output
    text = paginated_plain_text_output(pdf_path, sort=sort, hyphens=hyphens, page_range=page_range, workers=workers, flatten_pdf=flatten_pdf)
  File ".venv/lib/python3.13/site-packages/pdftext/extraction.py", line 76, in paginated_plain_text_output
    text.append(merge_text(page, sort=sort, hyphens=hyphens).strip())
                ~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.13/site-packages/pdftext/postprocessing.py", line 97, in merge_text
    page["blocks"] = sort_blocks(page["blocks"])
                     ~~~~~~~~~~~^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.13/site-packages/pdftext/postprocessing.py", line 80, in sort_blocks
    group_key = round(bbox[1] / tolerance) * tolerance
                      ~~~~^^^
TypeError: 'Bbox' object is not subscriptable
@simjak
Copy link
Contributor Author

simjak commented Jan 10, 2025

PR #27

@VikParuchuri
Copy link
Owner

Thanks for the fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants