iancmcc/ouimeaux

WeMo Mini 2020 - Ouimeaux server not installing or working

CoolGames opened this issue · 3 comments

Not sure if this is why wemo server not working with new WeMo Mini socket.
This is my first WeMo device so there is no previous version to compare.

Trying to make it work using all I can find but a lot is 404 not found or
getting errors such as...

$ wemo server
ouimeaux server dependencies are not installed. Please run, e.g., 'pip install ouimeaux[server]'

$ pip install ouimeaux[server]

DEPRECATION: Python 2.7 will reach the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 won't be maintained after that date. A future version of pip will drop support for Python 2.7. More details about Python 2 support in pip, can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support

Requirement already satisfied: ouimeaux[server] in ./lib/python2.7/site-packages (0.8.2)
Requirement already satisfied: gevent>=1.3.0 in ./lib/python2.7/site-packages (from ouimeaux[server]) (1.4.0)
Requirement already satisfied: six in ./lib/python2.7/site-packages (from ouimeaux[server]) (1.13.0)
Requirement already satisfied: pyyaml in ./lib/python2.7/site-packages (from ouimeaux[server]) (5.3)
Requirement already satisfied: requests>=2.3.0 in ./lib/python2.7/site-packages (from ouimeaux[server]) (2.22.0)
Requirement already satisfied: future in ./lib/python2.7/site-packages (from ouimeaux[server]) (0.18.2)
Requirement already satisfied: flask-cors; extra == "server" in ./lib/python2.7/site-packages (from ouimeaux[server]) (3.0.8)
Requirement already satisfied: flask-restful; extra == "server" in ./lib/python2.7/site-packages (from ouimeaux[server]) (0.3.7)
Requirement already satisfied: flask-basicauth; extra == "server" in ./lib/python2.7/site-packages (from ouimeaux[server]) (0.2.0)
Requirement already satisfied: gevent-socketio; extra == "server" in ./lib/python2.7/site-packages (from ouimeaux[server]) (0.3.6)
Requirement already satisfied: greenlet>=0.4.14; platform_python_implementation == "CPython" in ./lib/python2.7/site-packages (from gevent>=1.3.0->ouimeaux[server]) (0.4.15)
Requirement already satisfied: certifi>=2017.4.17 in ./lib/python2.7/site-packages (from requests>=2.3.0->ouimeaux[server]) (2019.11.28)
Requirement already satisfied: urllib3!=1.25.0,!=1.25.1,<1.26,>=1.21.1 in ./lib/python2.7/site-packages (from requests>=2.3.0->ouimeaux[server]) (1.25.7)
Requirement already satisfied: idna<2.9,>=2.5 in ./lib/python2.7/site-packages (from requests>=2.3.0->ouimeaux[server]) (2.8)
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in ./lib/python2.7/site-packages (from requests>=2.3.0->ouimeaux[server]) (3.0.4)
Requirement already satisfied: Flask>=0.9 in ./lib/python2.7/site-packages (from flask-cors; extra == "server"->ouimeaux[server]) (1.1.1)
Requirement already satisfied: pytz in ./lib/python2.7/site-packages (from flask-restful; extra == "server"->ouimeaux[server]) (2019.3)
Requirement already satisfied: aniso8601>=0.82 in ./lib/python2.7/site-packages (from flask-restful; extra == "server"->ouimeaux[server]) (8.0.0)
Requirement already satisfied: gevent-websocket in ./lib/python2.7/site-packages (from gevent-socketio; extra == "server"->ouimeaux[server]) (0.10.1)
Requirement already satisfied: click>=5.1 in ./lib/python2.7/site-packages (from Flask>=0.9->flask-cors; extra == "server"->ouimeaux[server]) (7.0)
Requirement already satisfied: Werkzeug>=0.15 in ./lib/python2.7/site-packages (from Flask>=0.9->flask-cors; extra == "server"->ouimeaux[server]) (0.16.0)
Requirement already satisfied: itsdangerous>=0.24 in ./lib/python2.7/site-packages (from Flask>=0.9->flask-cors; extra == "server"->ouimeaux[server]) (1.1.0)
Requirement already satisfied: Jinja2>=2.10.1 in ./lib/python2.7/site-packages (from Flask>=0.9->flask-cors; extra == "server"->ouimeaux[server]) (2.10.3)
Requirement already satisfied: MarkupSafe>=0.23 in ./lib/python2.7/site-packages (from Jinja2>=2.10.1->Flask>=0.9->flask-cors; extra == "server"->ouimeaux[server]) (1.1.1)

Anyone able to install this circa April 2020 on Raspbian?
Raspbian GNU/Linux 9.11 (stretch)
Release: 9.11
Codename: stretch

I am having similar issues, no luck so far.

The issue for me at least was that the Flask package has had a change in structure and ouimeaux's code doesn't seem to be updated to deal with that. You can see this error if you get rid of the try/except block surrounding the imports on lines 291/292 of lib/python2.7/site-packages/ouimeaux/cli.py

Then the actual underlying error is printed:

File ".../lib/python2.7/site-packages/ouimeaux/server/init.py", line 7, in
from flask.ext.restful import reqparse, abort, Api, Resource
ImportError: No module named ext.restful

That's because flask removed this namespace in April 2018 (version 1.0):

The following old deprecated code was removed. #2385
flask.ext - import extensions directly by their name instead of through the flask.ext namespace. For example, import flask.ext.sqlalchemy becomes import flask_sqlalchemy.

Some people seem to have had luck with trying to downgrade Flask, but I ran into further issues with older versions of Flask not correctly specifying its own dependencies.

So for me the fix was just to update lib/python2.7/site-packages/ouimeaux/server/__init__.py to use the new Flask namespaces by changing lines 7/8 from:

from flask.ext.restful import reqparse, abort, Api, Resource
from flask.ext.basicauth import BasicAuth

to:

from flask_restful import reqparse, abort, Api, Resource
from flask_basicauth import BasicAuth

After that change, the server starts and works

Note that I am using Python 2.7 here because under Python 3.X (specifically 3.8), there is a different incompatibility issue where the version of socketio (gevent-socketio, which is super old) that ouimeaux installs is not compatible with Python 3.8 due to this error:

File ".../lib/python3.8/site-packages/socketio/server.py", line 108
except error, ex:
^
SyntaxError: invalid syntax

The correct syntax would now be "except error as ex:" but I am not going to change socketio nor try to fix the dependency version issue.