hassio-addons icon indicating copy to clipboard operation
hassio-addons copied to clipboard

errors Stopping xbox-rest-server from running

Open shadow05139 opened this issue 5 years ago • 9 comments

this is my output running on my Stretch hassbain running HA vr0.89.1

Traceback (most recent call last): File "/usr/local/bin/xbox-rest-server", line 7, in from xbox.rest.scripts.rest_server import main File "/usr/local/lib/python2.7/dist-packages/xbox/rest/scripts/rest_server.py", line 9, in from xbox.rest.app import app File "/home/pi/.local/lib/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/xbox/rest/app.py", line 2, in from http import HTTPStatus File "/home/pi/.local/lib/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, **kwargs) ImportError: No module named http

shadow05139 avatar Mar 08 '19 21:03 shadow05139

You are not located within a python 3 virtualenv! (You can see that on the python2.7 string)

Here a suggestion how to deal with it:

  1. Change to homeassistant user sudo -u homeassistant -H -s
  2. Create a new directory for the xbox virtual environment mkdir /srv/homeassistant/xbox-venv
  3. Create the new environment python3 -m venv /srv/homeassistant/xbox-venv
  4. Activate the environment /srv/homeassistant/xbox-venv/bin/activate
  5. Install xbox-rest-server pip install xbox-rest-server
  6. Start it xbox-rest-server

PS: You can of course create an entirely new user to just serve the xbox rest server PPS: To start it as a service automatically, see README

tuxuser avatar Mar 08 '19 22:03 tuxuser

ok cool thanks for that will do that thnx :)

shadow05139 avatar Mar 08 '19 23:03 shadow05139

Im now snagged on 4. homeassistant@hassbian:/home/pi $ /srv/homeassistant/xbox-venv/bin/activate bash: /srv/homeassistant/xbox-venv/bin/activate: Permission denied

shadow05139 avatar Mar 09 '19 00:03 shadow05139

Normally that should not happen...

chmod +x /srv/homeassistant/xbox-venv/bin/activate

tuxuser avatar Mar 09 '19 01:03 tuxuser

got that sorted but now bun now pip wont install xbox-rest-server

homeassistant@hassbian:/home/pi $ pip install xbox-rest-server Collecting xbox-rest-server Could not find a version that satisfies the requirement xbox-rest-server (from versions: ) No matching distribution found for xbox-rest-server

shadow05139 avatar Mar 09 '19 22:03 shadow05139

Oops, its pip install xbox-smartglass-rest

tuxuser avatar Mar 09 '19 23:03 tuxuser

oh ok all good that's now put me right back at the start now with the same error within this env now :-/

homeassistant@hassbian:/home/pi $ xbox-rest-server Traceback (most recent call last): File "/usr/local/bin/xbox-rest-server", line 7, in from xbox.rest.scripts.rest_server import main File "/home/homeassistant/.local/lib/python2.7/site-packages/xbox/rest/scripts/rest_server.py", line 9, in from xbox.rest.app import app File "/home/homeassistant/.local/lib/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, **kwargs) File "/home/homeassistant/.local/lib/python2.7/site-packages/xbox/rest/app.py", line 2, in from http import HTTPStatus File "/home/homeassistant/.local/lib/python2.7/site-packages/gevent/builtins.py", line 96, in import result = _import(*args, **kwargs) ImportError: No module named http

shadow05139 avatar Mar 10 '19 00:03 shadow05139

You are either NOT YET in the python 3 virtual env - or not anymore, after installation. You have to stay in the python 3 context to execute it....

tuxuser avatar Mar 10 '19 01:03 tuxuser

alright got that all sorted was loading from installs outside the env fixed by running pip uninstall xbox-smartglass-rest as pi almost got it working but starting it returns command not found?

homeassistant@hassbian:/home/pi $ xbox-smartglass-rest bash: xbox-smartglass-rest: command not found

shadow05139 avatar Mar 10 '19 02:03 shadow05139