Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Fix AttributeError in PdfConverter when config is None #559

@saisiddharthg

Description

@saisiddharthg

When initializing PdfConverter, an AttributeError occurs if config is None because get() is called on a NoneType object.

Error:

  File "/home/siddarth/test/marker/test_marker.py", line 65, in process_pdfs_in_folder
    converter = PdfConverter(artifact_dict=create_model_dict())

  File "/home/siddarth/.local/lib/python3.10/site-packages/marker/converters/pdf.py", line 118, in __init__
    elif config.get("use_llm", False):

AttributeError: 'NoneType' object has no attribute 'get'

Modify line 118 to check if config is not None before calling .get():

elif config is not None and config.get("use_llm", False):
This ensures that config.get("use_llm", False) is only accessed if config is a valid dictionary.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions