fix cannot import name 'escape' from 'jinja2'#183
Open
sd3ntato wants to merge 4 commits intocamelot-dev:masterfrom
Open
fix cannot import name 'escape' from 'jinja2'#183sd3ntato wants to merge 4 commits intocamelot-dev:masterfrom
sd3ntato wants to merge 4 commits intocamelot-dev:masterfrom
Conversation
after the previous commit, i did
```
python3.8 -m venv .venv38
source .venv38/bin/activate
pip install .
excalibur initdb
excalibur webserver
```
and got the app running, but then when I uploaded a pdf I got this error:
```
ERROR:root:PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
Traceback (most recent call last):
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/excalibur/tasks.py", line 22, in split
extract_pages, total_pages = get_pages(file.filepath, file.pages)
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/excalibur/utils/task.py", line 29, in get_pages
infile = PdfFileReader(inputstream, strict=False)
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/PyPDF2/_reader.py", line 1974, in __init__
deprecation_with_replacement("PdfFileReader", "PdfReader", "3.0.0")
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/PyPDF2/_utils.py", line 369, in deprecation_with_replacement
deprecation(DEPR_MSG_HAPPENED.format(old_name, removed_in, new_name))
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/PyPDF2/_utils.py", line 351, in deprecation
raise DeprecationError(msg)
PyPDF2.errors.DeprecationError: PdfFileReader is deprecated and was removed in PyPDF2 3.0.0. Use PdfReader instead.
```
so i fixed PyPDF2==2.0 and the app manages to read pdfs and detect tables, but when i try to "view and download data" i get this:
```
ERROR:root:to_excel() got an unexpected keyword argument 'encoding'
Traceback (most recent call last):
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/excalibur/tasks.py", line 126, in extract
tables.export(f_datapath, f=f, compress=True)
File "/Users/valeriomariani/Desktop/test_excalibur/excalibur/.venv38/lib/python3.8/site-packages/camelot/core.py", line 736, in export
table.df.to_excel(writer, sheet_name=sheet_name, encoding="utf-8")
TypeError: to_excel() got an unexpected keyword argument 'encoding'
```
pip freeze | grep pandas pandas==2.0.3 but https://github.com/camelot-dev/camelot/blob/5c23e10702b1e53fefa71136d5e8ac2f0de9368a/pyproject.toml#L27 says ```pandas = "^1.5.3" ``` so i added requirement "pandas==1.5.3",
you can now docker ```compose up --build ``` and access http://localhost:5001
|
Combining this with #169 gets the local server working for me (mostly). I didn't test changes to docker though. I noticed that camelot now uses pypdf instead of PyPDF2. Seems like the next dependency hell is getting both modules on the same pdf stack. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
togheter with some fixed to the dependency hell, I added a docker compose config.