Skip to content

NoneType error occured in pymupdf.output_to_markdown function #28

New issue

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

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

Already on GitHub? # to your account

Closed
1 task done
mashihua opened this issue Apr 23, 2024 · 1 comment
Closed
1 task done

NoneType error occured in pymupdf.output_to_markdown function #28

mashihua opened this issue Apr 23, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@mashihua
Copy link
Contributor

Initial Checks

  • I confirm that I'm on the latest version

Description

I encountered the following error when processing a PDF file that contains multiple tables.

Traceback (most recent call last):
  File "/Users/mashihua/work/parser-test.py", line 29, in <module>
    parsed = parser.parse(basic_doc_path)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mashihua/anaconda3/lib/python3.11/site-packages/openparse/doc_parser.py", line 106, in parse
    table_elems = tables.ingest(doc, table_args_obj, verbose=self._verbose)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mashihua/anaconda3/lib/python3.11/site-packages/openparse/tables/parse.py", line 221, in ingest
    return _ingest_with_pymupdf(doc, parsing_args, verbose)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mashihua/anaconda3/lib/python3.11/site-packages/openparse/tables/parse.py", line 59, in _ingest_with_pymupdf
    text = pymupdf.output_to_markdown(headers, lines)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/mashihua/anaconda3/lib/python3.11/site-packages/openparse/tables/pymupdf/parse.py", line 25, in output_to_markdown
    markdown_output = "| " + " | ".join(headers) + " |\n"
TypeError: sequence item 2: expected str instance, NoneType found

Example Code

No response

@mashihua mashihua added the bug Something isn't working label Apr 23, 2024
mashihua added a commit to mashihua/open-parse that referenced this issue Apr 23, 2024
@Filimoa
Copy link
Owner

Filimoa commented Apr 24, 2024

Fixed with #32

@Filimoa Filimoa closed this as completed Apr 24, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants