Parsr icon indicating copy to clipboard operation
Parsr copied to clipboard

Error in Python Client;

Open spencerR1992 opened this issue 5 years ago • 5 comments

Summary When using param 'wait_till_finished' on ParsClient, error raised `--------------------------------------------------------------------------- NameError Traceback (most recent call last) in ----> 1 res = parsr.send_document( 2 file_path="BariatricSurgery.pdf", 3 config_path='defaultConfig.json', 4 document_name='The Readme', 5 refresh_period = 5, silent = False,

/usr/local/lib/python3.8/site-packages/parsr_client/parsr_client.py in send_document(self, file_path, config_path, server, document_name, revision, wait_till_finished, refresh_period, save_request_id, silent) 148 print('>> Job done!') 149 return { --> 150 'file': file, 151 'config': config, 152 'status_code': r.status_code,

NameError: name 'file' is not defined`

Looks like there's conflation between file_path and file in that send_document( function

Steps To Reproduce Steps to reproduce the behavior:

  1. Install Python Client pip install parsr-client
  2. Send Document like #python res = parsr.send_document( file_path="mydocument.pdf", config_path='defaultConfig.json', document_name='The Readme', refresh_period = 5, silent = False, save_request_id=True, wait_till_finished = True)
  3. See error

Expected behavior Return of object with reference to json, xml, and other attributes

Actual behavior A error

Screenshots If applicable, add screenshots to help explain your problem.

Environment

  • python=3.8.5
  • docker version of parsr-client

spencerR1992 avatar Aug 28 '20 18:08 spencerR1992

Hello @spencerR1992,

We will look at it and come back to you when solved.

dafelix42 avatar Aug 31 '20 07:08 dafelix42

Hello @spencerR1992 ,

There are 2 errors in lines 150 and 151 of parsr_client.py

You can replace this lines by: 'file': file_path, 'config': config_path,

It should solve you problem. It will be update in the next release.

Regards

dafelix42 avatar Aug 31 '20 07:08 dafelix42

Relevant: https://github.com/axa-group/Parsr/pull/490#issuecomment-688554007

royjohal avatar Sep 10 '20 06:09 royjohal

After instlling from PIP on 21.05.2021, I found this to still be an issue when running from the command line. Also, the Jupyter Notebook Demo still invokes the wrong (old) command in the first place, this should be fixed as well.

AndBu avatar May 21 '21 10:05 AndBu

It would be nice if you published a new release to PyPI that incorporates this fix.

kgeis avatar Sep 10 '22 19:09 kgeis