Skip to content

IndexError: list index out of range #1193

@doncat99

Description

@doncat99

Bug

...

Steps to reproduce

...

Docling version

...

Python version

...

when i convert a pdf document what page_range parameter:
conv_result = doc_converter.convert(input_doc_path, page_range=page_range)

it raised error as below:

Image

the supposed correction would be:
from:

page_ix = element.prov[0].page_no - 1
page = conv_res.pages[page_ix]
assert page.size is not None
assert page.image is not None

to:

page_ix = element.prov[0].page_no - 1
page = next((item for item in conv_res.pages if item.page_no == page_ix), None)
assert page is not None
assert page.size is not None
assert page.image is not None

in standard_pdf_pipeline.py file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions