codereverser/casparser-web

Not working with new casparser

vipulrvtech opened this issue · 4 comments

I have updated the casparser but ir is not working pydantic and fastcgi error are coming.

Oops. forgot to push fixes to this repo. Can you please test with the latest version?

Frankly Speaking, I am not a Python developer I work on node and PHP, and I have used your code I checked the code it was creating caos in updating the Pydantic version. below are the traces I am getting on uploading files.
Traceback (most recent call last):
File "/usr/local/bin/casparser", line 8, in
sys.exit(cli())
File "/usr/lib/python3/dist-packages/click/core.py", line 1128, in call
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 1053, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 1395, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 754, in invoke
return _callback(*args, **kwargs)
File "/usr/local/lib/python3.10/dist-packages/casparser/cli.py", line 339, in cli
data = read_cas_pdf(filename, password, force_pdfminer=force_pdfminer)
File "/usr/local/lib/python3.10/dist-packages/casparser/parsers/init.py", line 36, in read_cas_pdf
processed_data = process_cas_text("\u2029".join(partial_cas_data.lines))
File "/usr/local/lib/python3.10/dist-packages/casparser/process/init.py", line 29, in process_cas_text
return process_detailed_text(text)
File "/usr/local/lib/python3.10/dist-packages/casparser/process/cas_detailed.py", line 144, in process_detailed_text
statement_period = StatementPeriod(from
=hdr_data["from"], to=hdr_data["to"])
File "pydantic/main.py", line 341, in pydantic.main.BaseModel.init
pydantic.error_wrappers.ValidationError: 1 validation error for StatementPeriod
from
field required (type=value_error.missing)

Looks like environment is still using old pydantic v1 .. Can you try running

git pull 
pip3 install -r requirements.txt

in the root folder. This should upgrade all packages to the latest version.

Verified that the code works on a fresh checkout. Issue seems to be with local python environment. Closing the issue.

For small tests, you may consider using the demo website hosted @ https://cas.atomcoder.com ; It is always in sync with the latest version from the repo.