Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Table_regions #312

Closed
eldarvagapov opened this issue Apr 16, 2019 · 6 comments · Fixed by #332
Closed

Table_regions #312

eldarvagapov opened this issue Apr 16, 2019 · 6 comments · Fixed by #332
Labels

Comments

@eldarvagapov
Copy link

table_regions kwarg throws an ValueError: too many values to unpack (expected 4)

tables = camelot.read_pdf('sberbank_statement.pdf', flavor='stream', pages='1-end', table_regions=['168,145,568,740'])

where
168 = Left,
145 = Top
568 = Left + Width
740 = Top + Height

`/anaconda3/lib/python3.7/site-packages/camelot/parsers/stream.py in _generate_table_bbox(self)
287 hor_text = []
288 for region in self.table_regions:
--> 289 x1, y1, x2, y2 = region
290 region_text = text_in_bbox((x1, y2, x2, y1), self.horizontal_text)
291 hor_text.extend(region_text)

ValueError: too many values to unpack (expected 4)`

@anakin87
Copy link

I get the same error.
Don't know why, but with flavor='lattice', I don't get this error.

@joeyjustcuz
Copy link

im getting this error also

scamelot\parsers\stream.py line 289

my code:

tables = cm.read_pdf(file, pages='1',flavor='stream', table_regions=['9,8,7,6'])
valueError: too many values to unpack (expected 4)

@vinayak-mehta
Copy link
Contributor

I know why this is happening. From the traceback, the region string is not being split like an area is being split (you can see it not too down below). We just need to convert it to region.split(','). I'll push a fix tonight.

@eldarvagapov
Copy link
Author

@vinayak-mehta - did you manage to push that fix in the end?

@vinayak-mehta
Copy link
Contributor

I remember creating a branch and adding that fix, but it clearly isn't in master or in the PRs. Let me push it today.

vinayak-mehta added a commit that referenced this issue May 26, 2019
vinayak-mehta added a commit that referenced this issue May 27, 2019
@vinayak-mehta
Copy link
Contributor

Thanks for the bug report @eldarvagapov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants