I have a script that is iterating through images of different forms. When parsing the Google Vision Text detection response, I use the XY coordinates in the 'boundingPoly' for each text item to specifically look for data in different parts of the form.
The problem I'm having is that some of the responses come back with only an X coordinate. Example:
{u'description': u'sometext', u'boundingPoly': {u'vertices': [{u'x': 5595}, {u'x': 5717}, {u'y': 122, u'x': 5717}, {u'y': 122, u'x': 5595}
I've set a try/except (using python 2.7) to catch this issue, but it's always the same issue: KeyError: 'y'
. I'm iterating through thousands of forms; so far it has happened to 10 rows out of 1000.
Has anyone had this issue before? Is there a fix other than attempting to re-submit the request if it reaches this error?