amazon-textract-textractor icon indicating copy to clipboard operation
amazon-textract-textractor copied to clipboard

Overlayer broken with DocumentDimension not subscritable

Open miluna8 opened this issue 2 years ago • 1 comments


TypeError Traceback (most recent call last) Cell In[45], line 12 9 document_dimension:DocumentDimensions = DocumentDimensions(doc_width=image.size[0], doc_height=image.size[1]) 10 overlay=[Textract_Types.WORD, Textract_Types.CELL] ---> 12 bounding_box_list = get_bounding_boxes(textract_json=doc, document_dimensions=document_dimension, overlay_features=overlay)

File ~/anaconda3/envs/python3/lib/python3.10/site-packages/textractoverlayer/t_overlay.py:103, in get_bounding_boxes(textract_json, overlay_features, document_dimensions) 101 page_number: int = 0 102 for page in doc.pages: --> 103 page_dimensions = document_dimensions[page_number] 104 page_number += 1 105 if (Textract_Types.WORD in overlay_features or Textract_Types.LINE in overlay_features):

TypeError: 'DocumentDimensions' object is not subscriptable

miluna8 avatar May 18 '23 21:05 miluna8

wrapping the document dimensions in list fixed this for me.

bounding_box_list = get_bounding_boxes(textract_json=textract_json, document_dimensions=[document_dimension], overlay_features=overlay)
    

jasonchester avatar Mar 01 '24 17:03 jasonchester