key error = "Operation-Location"

Prabhala, Manasa 1 Reputation point
2021-07-16T06:01:56.537+00:00

Using the code from here: https://github.com/Azure-Samples/cognitive-services-quickstart-code/blob/master/python/ComputerVision/REST/python-hand-text.md

I iterate over the code to detect text in multiple local images (around 100 images); however, I get key error = "Operation-Location" after a few number of iterations varying every rerun. How do I go about fixing it?

Azure Computer Vision
Azure Computer Vision
An Azure artificial intelligence service that analyzes content in images and video.
345 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. romungi-MSFT 43,691 Reputation points Microsoft Employee
    2021-07-16T06:55:16.797+00:00

    @Anonymous The sample you referenced is using an image url to call the API. Have you modified your code to pass the local file as binary stream to the read API?
    If Yes, for a successful operation the result will contain an operation location. Basically an id that needs to be passed to another API called read result API to get the actual result of your first read operation.
    Since you are receiving an error I think the Read API call is not successful.

    I would recommend to follow steps in this sample instead, since you are using local images. It is east to modify to loop through your images and provide a read result.