Core: Kodi won't load in HA

Created on 2 Dec 2016  路  17Comments  路  Source: home-assistant/core

Make sure you are running the latest version of Home Assistant before reporting an issue.

You should only file an issue if you found a bug. Feature and enhancement requests should go in the Feature Requests section of our community forum:

Home Assistant release (hass --version):
0.33.4

Python release (python3 --version):
3.5.2

Component/platform:
Kodi

Description of problem:
Kodi doesn't load after updating to the latest HA version. It worked fine in 31.1.

Even after downgrading back to 31.1, it still doesn't work. However, if I revert back to the snapshot taken before upgrading, it works fine. So it looks like it might be that some other component other than HA is getting upgraded.

Here's what I see in the logs

ERROR:homeassistant.components.media_player:Error while setting up platform kodi
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/helpers/entity_component.py", line 150, in _async_setup_platform
    entity_platform.add_entities, discovery_info
  File "/usr/lib/python3.5/asyncio/futures.py", line 361, in __iter__
    yield self  # This tells Task to wait for completion.
  File "/usr/lib/python3.5/asyncio/tasks.py", line 296, in _wakeup
    future.result()
  File "/usr/lib/python3.5/asyncio/futures.py", line 274, in result
    raise self._exception
  File "/usr/lib/python3.5/concurrent/futures/thread.py", line 55, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/kodi.py", line 59, in setup_platform
    turn_off_action=config.get(CONF_TURN_OFF_ACTION)),
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/kodi.py", line 80, in __init__
    self.update()
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/kodi.py", line 114, in update
    self._players = self._get_players()
  File "/usr/local/lib/python3.5/dist-packages/homeassistant/components/media_player/kodi.py", line 91, in _get_players
    return self._server.Player.GetActivePlayers()
  File "/home/osboxes/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 112, in __call__
    return self.__request_method(self.__method_name, args, kwargs)
  File "/home/osboxes/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 96, in __request
    return self.send_request(method_name, is_notification, args or kwargs)
  File "/home/osboxes/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 37, in send_request
    response = self.request(data=request_body)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 535, in post
    return self.request('POST', url, data=data, json=json, **kwargs)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 474, in request
    prep = self.prepare_request(req)
  File "/usr/local/lib/python3.5/dist-packages/requests/sessions.py", line 407, in prepare_request
    hooks=merge_hooks(request.hooks, self.hooks),
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 306, in prepare
    self.prepare_auth(auth, url)
  File "/usr/local/lib/python3.5/dist-packages/requests/models.py", line 527, in prepare_auth
    r = auth(self)
  File "/usr/local/lib/python3.5/dist-packages/requests/auth.py", line 68, in __call__
    r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
  File "/usr/local/lib/python3.5/dist-packages/requests/auth.py", line 38, in _basic_auth_str
    b64encode(b':'.join((username, password))).strip()
TypeError: sequence item 0: expected a bytes-like object, NoneType found
ERROR:homeassistant.components.media_player:Error while setting up platform kodi

Most helpful comment

@ronvl pip uninstall requests && pip install requests==2.12.1

All 17 comments

I'm having the same problem

same here

Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/kodi.py", line 59, in setup_platform
Dec 02 15:16:44 raspberrypi hass[303]: turn_off_action=config.get(CONF_TURN_OFF_ACTION)),
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/kodi.py", line 80, in __init__
Dec 02 15:16:44 raspberrypi hass[303]: self.update()
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/kodi.py", line 114, in update
Dec 02 15:16:44 raspberrypi hass[303]: self._players = self._get_players()
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/homeassistant/components/media_player/kodi.py", line 91, in _get_players
Dec 02 15:16:44 raspberrypi hass[303]: return self._server.Player.GetActivePlayers()
Dec 02 15:16:44 raspberrypi hass[303]: File "/home/pi/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 112, in __call__
Dec 02 15:16:44 raspberrypi hass[303]: return self.__request_method(self.__method_name, args, kwargs)
Dec 02 15:16:44 raspberrypi hass[303]: File "/home/pi/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 96, in __request
Dec 02 15:16:44 raspberrypi hass[303]: return self.send_request(method_name, is_notification, args or kwargs)
Dec 02 15:16:44 raspberrypi hass[303]: File "/home/pi/.homeassistant/deps/jsonrpc_requests/jsonrpc.py", line 37, in send_request
Dec 02 15:16:44 raspberrypi hass[303]: response = self.request(data=request_body)
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 535, in post
Dec 02 15:16:44 raspberrypi hass[303]: return self.request('POST', url, data=data, json=json, **kwargs)
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 474, in request
Dec 02 15:16:44 raspberrypi hass[303]: prep = self.prepare_request(req)
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/sessions.py", line 407, in prepare_request
Dec 02 15:16:44 raspberrypi hass[303]: hooks=merge_hooks(request.hooks, self.hooks),
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/models.py", line 306, in prepare
Dec 02 15:16:44 raspberrypi hass[303]: self.prepare_auth(auth, url)
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/models.py", line 527, in prepare_auth
Dec 02 15:16:44 raspberrypi hass[303]: r = auth(self)
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/auth.py", line 68, in __call__
Dec 02 15:16:44 raspberrypi hass[303]: r.headers['Authorization'] = _basic_auth_str(self.username, self.password)
Dec 02 15:16:44 raspberrypi hass[303]: File "/usr/local/lib/python3.4/dist-packages/requests/auth.py", line 38, in _basic_auth_str
Dec 02 15:16:44 raspberrypi hass[303]: b64encode(b':'.join((username, password))).strip()
Dec 02 15:16:44 raspberrypi hass[303]: TypeError: sequence item 0: expected bytes, bytearray, or an object with the buffer interface, NoneType found

When we run a pip3 install --upgrade homeassistant, what other stuff is getting upgraded besides HA? I'm pretty sure the problem lies in there as downgrading doesn't fix it(since downgrading probably only downgrades the HA version).

This is due to a bug in requests - rolling back to 2.12.1 resolves it for me.

@Iwis can you explain what you mean with rollback to 2.12.1? What do we need to rollback?

@ronvl pip uninstall requests && pip install requests==2.12.1

Thanks!!! That did the trick!!!

@lwis Aweseme. That fixed it for me as well. So do I leave this issue open or should I close it?

Fixed here too.

@simpat1zq - I guess leave open until manual fix is not required?

Sounds good. I'll wait.

This is still a problem in 34.2

@lwis do you know what's prompting the update, all i see in the kodi platform is jsonrpc-requests==0.3

@Spartan-II-117 jsonrpc-requests depends on requests.

I have a fix for it here https://github.com/home-assistant/home-assistant/pull/4770, can anyone try it?

Is there a way to try it from within Docker?

@balloob fix #4770 fixes the problem for me atleast.

@balloob #4770 fixes it for me too

Was this page helpful?
0 / 5 - 0 ratings

Related issues

TheZoker picture TheZoker  路  3Comments

arangates picture arangates  路  3Comments

Konstigt picture Konstigt  路  3Comments

neonandu picture neonandu  路  3Comments

moskovskiy82 picture moskovskiy82  路  3Comments