img2table icon indicating copy to clipboard operation
img2table copied to clipboard

Receiving `None` in `rel_rows`

Open UnayShah opened this issue 1 year ago • 2 comments

Receiving None value inside rel_rows.

{'min_row': None, 'max_row': None} https://github.com/xavctn/img2table/blob/f93294078e85b2dcc6efcf64c3d6e7e7e491f412/src/img2table/tables/processing/borderless_tables/init.py#L48-L52

While I haven't been able to fully understand the process of calculating the rel_rows values, my suggestion is putting a 0 as the default value instead of None:

    if len(rel_rows) > 0:
        # Get new rows
        new_rows = tb.items[rel_rows[0].get("min_row", 0):rel_rows[0].get("max_row", 0) + 1]
        if len(new_rows) >= 2:
            return Table(rows=new_rows, borderless=True)

UnayShah avatar Nov 23 '24 09:11 UnayShah

Have you resolved the issue? Because I am encountering the same error as well.

iremyk avatar Apr 03 '25 11:04 iremyk

Yes, I have resolved it and raised a pull request for the code. You can find the code I used to fix this over here: https://github.com/xavctn/img2table/pull/236/commits/ad0bde4c0ce61d5929df833834cc07e397209b40

Do let me know if you still face this issue or find a better fix to this problem.

I also faced this issue and did a fix for it: https://github.com/xavctn/img2table/pull/237

Unay-Shah avatar Apr 05 '25 02:04 Unay-Shah