custom-components / sensor.tautulli

A platform which allows you to get information from Tautulli.
MIT License
8 stars 2 forks source link

UnboundLocalError: local variable 'result' referenced before assignment #5

Closed ludeeus closed 6 years ago

ludeeus commented 6 years ago

Version of the cusom_component 0.0.6

Describe the bug Some times (not consistent) there is a stacktrace in the log

log

2018-07-25 20:05:57 ERROR (MainThread) [homeassistant.helpers.entity] Update for sensor.tautulli fails
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 196, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 319, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/tautulli.py", line 65, in update
    self._port, self._api_key)
  File "/config/deps/lib/python3.6/site-packages/pytautulli/__init__.py", line 88, in get_home_stats
    if result:
UnboundLocalError: local variable 'result' referenced before assignment
ludeeus commented 6 years ago

Same for user

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 196, in async_update_ha_state
    yield from self.async_device_update()
  File "/usr/local/lib/python3.6/site-packages/homeassistant/helpers/entity.py", line 319, in async_device_update
    yield from self.hass.async_add_job(self.update)
  File "/usr/local/lib/python3.6/concurrent/futures/thread.py", line 56, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/config/custom_components/sensor/tautulli.py", line 110, in update
    self._port, self._api_key, self._username)
  File "/config/deps/lib/python3.6/site-packages/pytautulli/__init__.py", line 61, in get_user_activity
    verify_user(host, port, api_key, username)
  File "/config/deps/lib/python3.6/site-packages/pytautulli/__init__.py", line 40, in verify_user
    return user
UnboundLocalError: local variable 'user' referenced before assignment
stale[bot] commented 6 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.