invoice2data icon indicating copy to clipboard operation
invoice2data copied to clipboard

Input readers error

Open erkin98 opened this issue 3 years ago • 2 comments

When using a input readers except googlevision there gives an error

AttributeError                            Traceback (most recent call last)
<ipython-input-42-846894c98fd2> in <module>
      5 templates = read_templates('templates')
      6 print(templates)
----> 7 result = extract_data(filename, templates=templates,input_module = 'pdfminer')
      8 print(result)

c:\programdata\miniconda3\lib\site-packages\invoice2data\main.py in extract_data(invoicefile, templates, input_module)
     80 
     81     # print(templates[0])
---> 82     extracted_str = input_module.to_text(invoicefile).decode('utf-8')
     83 
     84     logger.debug('START pdftotext result ===========================')

AttributeError: 'str' object has no attribute 'to_text'

erkin98 avatar Mar 10 '21 07:03 erkin98

i dont try google vision yet but all of them gives this error

erkin98 avatar Mar 10 '21 07:03 erkin98

Your input_module parameter shouldn't be a string, it should just be input_module = pdfminer as the function calls for the to_text() function of the input_module classes

jintaogao avatar Jul 02 '21 19:07 jintaogao

@jintaogao was correct, thanks @jintaogao for your help here

rmilecki avatar Sep 30 '22 16:09 rmilecki