robmarkcole / deepstack-python

Unofficial python API for DeepStack
https://deepstack.cc/
GNU General Public License v3.0
12 stars 11 forks source link

Can be success = False but no error #16

Closed robmarkcole closed 4 years ago

robmarkcole commented 5 years ago

Reported on the forums by @reneeetje:

2019-10-03 18:01:06 ERROR (MainThread) [homeassistant.helpers.entity] Update for image_processing.detectie_persoon_tpu_voordeur fails
Traceback (most recent call last):
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 261, in async_update_ha_state
    await self.async_device_update()
  File "/usr/src/homeassistant/homeassistant/helpers/entity.py", line 439, in async_device_update
    await self.async_update()
  File "/usr/src/homeassistant/homeassistant/components/image_processing/__init__.py", line 136, in async_update
    await self.async_process_image(image.content)
  File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/deepstack_object/image_processing.py", line 150, in process_image
    self._dsobject.detect(image)
  File "/usr/local/lib/python3.7/site-packages/deepstack/core.py", line 129, in detect
    error = response.json()["error"]
KeyError: 'error'

This occurs at:

        if response.status_code == HTTP_OK:
            if response.json()["success"]:
                self._predictions = response.json()["predictions"]
            else:
                error = response.json()["error"]
                raise DeepstackException(f"Error from Deepstack: {error}")