IndexError while using split_text
See original GitHub issueIndexError
thrown when using split_text=True
Traceback (most recent call last):
File "/code/seperate_page.py", line 16, in <module>
tables = camelot.read_pdf(out_filename,
File "/usr/local/lib/python3.9/site-packages/camelot/io.py", line 113, in read_pdf
tables = p.parse(
File "/usr/local/lib/python3.9/site-packages/camelot/handlers.py", line 176, in parse
t = parser.extract_tables(
File "/usr/local/lib/python3.9/site-packages/camelot/parsers/lattice.py", line 431, in extract_tables
table = self._generate_table(table_idx, cols, rows, v_s=v_s, h_s=h_s)
File "/usr/local/lib/python3.9/site-packages/camelot/parsers/lattice.py", line 372, in _generate_table
indices = Lattice._reduce_index(
File "/usr/local/lib/python3.9/site-packages/camelot/parsers/lattice.py", line 191, in _reduce_index
if t.cells[r_idx][c_idx].hspan:
IndexError: list index out of range
Steps to reproduce the bug
Code
import camelot
# add your code here
tables = camelot.read_pdf('service_providers_ul.0.pdf',
backend='poppler',
pages='1',
flavor='lattice',
split_text=True)
Screenshots
Not Applicable
Environment
- OS: Linux
- Python version: 3.9.4
- Numpy version: 1.22.1
- OpenCV version: 4.5.5.6
- Ghostscript version: 0.7
- Camelot version: 0.10.1
Additional context
There is an empty textline in one of the rows which goes past the edge of the last column, this causes split_textline code to assign a column index past the availble column indices, and causes the code to throw an exception further down the line when the assigned column index is used
Issue Analytics
- State:
- Created 2 years ago
- Comments:11
Top Results From Across the Web
Python list index out of range on return value of split
When you are working with list and trying to get value at particular index, it is always safe to see in ...
Read more >Solved: Split Text Base on Multiple Delimiters - Esri Community
IndexError: list index out of range. I think this is caused by gaps in my data. I looked to make sure it was...
Read more >IndexError: list index out of range In extract the mode, product ...
Hello everybody, thanks in advance for you're insight !! After installing Snappy on my environment, I'am trying to preprocess sentinel 1 ...
Read more >IndexError: list index out of range - Python Forum
I am facing below error while executing the code . Dont know where exactly the error exists . Could you please help me...
Read more >How to Fix IndexError in Python - Rollbar
Table of Contents. What Causes IndexError; Python IndexError Example; How to Fix IndexError in Python; Track, Analyze and Manage Errors With ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
it might be the same issue. Running with the following fix went through
I personally pinned the camelot version in my project and monkeypatched the fix in.