Camelot processes the file, finds the table on page 1 and exports it to the excel file.
Code
Not applicable, using the provided command line wrapper.
PDF
Not relevant, error is independent of any PDF file.
Screenshots
Not a screenshot, but the Output from Camelot:
$ camelot --output table.xlsx --format excel lattice TestPDF.pdf
2023-05-16T18:23:10 - INFO - Processing page-1
Found 1 tables
Traceback (most recent call last):
File "/home/seronet/ERF-Table-Hack/bin/camelot", line 8, in <module>
sys.exit(cli())
File "/usr/lib/python3/dist-packages/click/core.py", line 764, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/lib/python3/dist-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/camelot/cli.py", line 213, in lattice
tables.export(output, f=f, compress=compress)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/camelot/core.py", line 751, in export
table.df.to_excel(writer, sheet_name=sheet_name, encoding="utf-8")
TypeError: to_excel() got an unexpected keyword argument 'encoding'
After removing the offending encoding="utf-8" I get:
$ camelot --output table.xlsx --format excel lattice TestPDF.pdf
2023-05-16T18:38:47 - INFO - Processing page-1
Found 1 tables
/usr/lib/python3/dist-packages/requests/__init__.py:89: RequestsDependencyWarning: urllib3 (1.25.8) or chardet (5.1.0) doesn't match a supported version!
warnings.warn("urllib3 ({}) or chardet ({}) doesn't match a supported "
Traceback (most recent call last):
File "/home/seronet/ERF-Table-Hack/bin/camelot", line 8, in <module>
sys.exit(cli())
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
return self.main(*args, **kwargs)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/core.py", line 1055, in main
rv = self.invoke(ctx)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/decorators.py", line 84, in new_func
return ctx.invoke(f, obj, *args, **kwargs)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/click/core.py", line 760, in invoke
return __callback(*args, **kwargs)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/camelot/cli.py", line 213, in lattice
tables.export(output, f=f, compress=compress)
File "/home/seronet/ERF-Table-Hack/lib/python3.8/site-packages/camelot/core.py", line 752, in export
writer.save()
AttributeError: 'OpenpyxlWriter' object has no attribute 'save'
Environment
OS: Linux Ubuntu 20.04
Python version: Python 3.8.10 (default, Mar 13 2023, 10:26:41)
Numpy version: 1.24.3
OpenCV version: 4.2
openvc-python version: 4.7.0.72
Ghostscript version: 9.50
ghostscript (PIP) version: 0.7
Camelot version: 0.11.0
pandas (PIP) version: 2.0.1
openpyxl (PIP) version: 3.1.2
Additional context
None I am aware of. Feel free to ask (@ mention) if you need more info.
Description
I did a fresh install of Camelot in a virtual environment.
Trying to export a PDF to Excel results in
TypeError: to_excel() got an unexpected keyword argument 'encoding'
Removing the encoding parameter in core.py line 751 results in another error:
AttributeError: 'OpenpyxlWriter' object has no attribute 'save'
It seems some dependency versions mismatch?
pip reports no broken dependencies when running
pip check
Steps to reproduce the bug
Steps used to install
camelot
:virtualenv --system-site-packages --symlinks TableTests
TableTests
environment:pip install camelot-py[cv] tabulate tabula-py PyPDF2 ghostscript
pip install -U numpy pandas matplotlib openpyxl
camelot --version
results in0.11.0
Steps to be used to reproduce behavior:
With in the virtual environment, run
camelot --output table.xlsx --format excel lattice TestPDF.pdf
Expected behavior
Camelot processes the file, finds the table on page 1 and exports it to the excel file.
Code
Not applicable, using the provided command line wrapper.
PDF
Not relevant, error is independent of any PDF file.
Screenshots
Not a screenshot, but the Output from Camelot:
After removing the offending
encoding="utf-8"
I get:Environment
Additional context
None I am aware of. Feel free to ask (@ mention) if you need more info.