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

AttributeError: 'FileExtension' object has no attribute 'mimetype' #201

Open
lmpentland opened this issue Dec 18, 2024 · 0 comments
Open

Comments

@lmpentland
Copy link

when trying to run

def parse_file(file_path):
    parser = UnstructuredParser()
    megaparse = MegaParse(parser)
    parsed_output = megaparse.load(file_path)
    print(parsed_output)
    return parsed_output

I get this error:

Traceback (most recent call last):
  File "C:\Users\mikes\anaconda3\envs\speedread\Lib\site-packages\megaparse\megaparse.py", line 89, in aload
    parsed_document = await parser.convert(
                      ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\mikes\anaconda3\envs\speedread\Lib\site-packages\megaparse\parser\unstructured_parser.py", line 114, in convert
    content_type=file_extension.mimetype if file_extension else None,
                 ^^^^^^^^^^^^^^^^^^^^^^^
AttributeError: 'FileExtension' object has no attribute 'mimetype'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "c:\Users\m\OneDrive\Documents\Python Scripts\speedtest\main.py", line 62, in <module>
    parsed_data = parse_file(file_path)
                  ^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\m\OneDrive\Documents\Python Scripts\speedtest\main.py", line 31, in parse_file
    parsed_output = megaparse.load(file_path)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\m\anaconda3\envs\speedread\Lib\site-packages\megaparse\megaparse.py", line 109, in load
    return loop.run_until_complete(
           ^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\m\anaconda3\envs\speedread\Lib\asyncio\base_events.py", line 654, in run_until_complete
    return future.result()
           ^^^^^^^^^^^^^^^
  File "C:\Users\m\anaconda3\envs\speedread\Lib\site-packages\megaparse\megaparse.py", line 98, in aload
    raise ParsingException(
megaparse.exceptions.base.ParsingException: Error while parsing file data\test.pdf, file_extension: FileExtension.PDF: 'FileExtension' object has no attribute 'mimetype'

with version 0.0.52 on windows machine

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

1 participant