-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Closed
Description
- Package Name: sample_recognize_receipts.py and sample_recognize_receipts_from_url.py
- Package Version: Current
- Operating System: Any
- Python Version: 3.9
Describe the bug
If the receipt is not itemized an error is display in the sample
To Reproduce
Steps to reproduce the behavior:
- have a receipt without items
- run
python sample_recognize_receipts.pyon that receipt
Expected behavior
The program should complete successfully even without items.
Screenshots
This is the output of a run of the sample in one document I have:
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-21-84af238b6b50> in <module>
----> 1 PrintReceipt(receipt_lst[6])
<ipython-input-20-09663b52ec70> in PrintReceipt(receipts)
13 print("Receipt items:")
14 # if receipt.fields.get("Items"):
---> 15 for idx, item in enumerate(receipt.fields.get("Items").value):
16 print("...Item #{}".format(idx+1))
17 item_name = item.value.get("Name")
AttributeError: 'NoneType' object has no attribute 'value'Additional context
None.