camelot-dev / camelot-dev/camelot
Other index error in lattice parser
- Dominant language
- Python
- Stars
- 3.8k
- Forks
- 546
- Avg merge
- 3d 17h
- Merged PRs (30d)
- 3
Description
I tried to extract tables from this [PDF](https://github.com/camelot-dev/camelot/files/3950873/191204A61SO2.pdf) with the following code:
`tables=camelot.read_pdf('mydoc.pdf', flavor='lattice' , line_scale=80, pages='1-end')`
**Error**
Traceback (most recent call last):
File "/usr/src/app/swagger_server/services/extract_tables_from_pdf.py", line 108, in extract_tables_from_path
tables = camelot.read_pdf(filename, pages=pages_string, **params_set)
File "/usr/local/lib/python3.6/site-packages/camelot/io.py", line 106, in read_pdf
layout_kwargs=layout_kwargs, **kwargs)
File "/usr/local/lib/python3.6/site-packages/camelot/handlers.py", line 162, in parse
layout_kwargs=layout_kwargs)
File "/usr/local/lib/python3.6/site-packages/camelot/parsers/lattice.py", line 359, in extract_tables
table = self._generate_table(table_idx, cols, rows, v_s=v_s, h_s=h_s)
File "/usr/local/lib/python3.6/site-packages/camelot/parsers/lattice.py", line 293, in _generate_table
table = table.set_border()
File "/usr/local/lib/python3.6/site-packages/camelot/core.py", line 484, in set_border
self.cells[r][0].left = True
IndexError: list index out of range
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the failure with the linked PDF and the shown camelot.read_pdf call. Inspect camelot/parsers/lattice.py around _generate_table and camelot/core.py around set_border, then verify that parsing this document no longer raises IndexError and produces the expected table result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- data
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100