mrstegeman / mpd-webthing

Turn MPD into a Web Thing
Mozilla Public License 2.0
10 stars 2 forks source link

mpd.py socket.error #2

Closed novski closed 3 years ago

novski commented 4 years ago

Tried to use on Mediatek Smart 7688 on openWRTv19.02 and run in to this: Seams not related directly to mpd-webthing but im not able to find out where this mpd.py comes from.

root@openwrt:~/mpd-webthing/python# sh run.sh
Collecting python-mpd2>=1.0.0 (from -r requirements.txt (line 1))
  Downloading https://files.pythonhosted.org/packages/6a/3c/f74c3b5e0dba3581468c0bc70058ec0e174a9a2f2041969ef955efaa1b2a/python_mpd2-1.0.0-py2.py3-none-any.whl
Collecting webthing>=0.12.0 (from -r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/b2/be/4590f69026d7407d8f08e875258bf0bf9e7d64311eebe3fef4b9f15fc25a/webthing-0.13.0-py3-none-any.whl
Collecting zeroconf>=0.26.0 (from webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/b9/69/8f11a2917240e8bb1f2210ba3a84d69d46486caafcce5ea90d00b6042172/zeroconf-0.26.1-py3-none-any.whl (67kB)
     |████████████████████████████████| 71kB 649kB/s 
Collecting pyee>=7.0.0 (from webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/f6/28/1cedd44c27907f1507a28ff2d36fc6cdb981c9deff2fa288bc48a700c7c9/pyee-7.0.2-py2.py3-none-any.whl
Collecting jsonschema>=3.2.0 (from webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/c5/8f/51e89ce52a085483359217bc72cdbf6e75ee595d5b1d4b5ade40c7e018b8/jsonschema-3.2.0-py2.py3-none-any.whl (56kB)
     |████████████████████████████████| 61kB 629kB/s 
Collecting ifaddr>=0.1.0 (from webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/9f/54/d92bda685093ebc70e2057abfa83ef1b3fb0ae2b6357262a3e19dfe96bb8/ifaddr-0.1.6.tar.gz
Collecting tornado>=6.0.0 (from webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/95/84/119a46d494f008969bf0c775cb2c6b3579d3c4cc1bb1b41a022aa93ee242/tornado-6.0.4.tar.gz (496kB)
     |████████████████████████████████| 501kB 772kB/s 
Collecting six>=1.11.0 (from jsonschema>=3.2.0->webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/65/eb/1f97cb97bfc2390a276969c6fae16075da282f5058082d4cb10c6c5c1dba/six-1.14.0-py2.py3-none-any.whl
Collecting attrs>=17.4.0 (from jsonschema>=3.2.0->webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/a2/db/4313ab3be961f7a763066401fb77f7748373b6094076ae2bda2806988af6/attrs-19.3.0-py2.py3-none-any.whl
Collecting importlib-metadata; python_version < "3.8" (from jsonschema>=3.2.0->webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/ad/e4/891bfcaf868ccabc619942f27940c77a8a4b45fd8367098955bb7e152fb1/importlib_metadata-1.6.0-py2.py3-none-any.whl
Collecting pyrsistent>=0.14.0 (from jsonschema>=3.2.0->webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/9f/0d/cbca4d0bbc5671822a59f270e4ce3f2195f8a899c97d0d5abb81b191efb5/pyrsistent-0.16.0.tar.gz (108kB)
     |████████████████████████████████| 112kB 1.2MB/s 
Collecting setuptools (from jsonschema>=3.2.0->webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/2c/c5/0d38afb961f83e0d51f319f7dc166195ebabc1ea3cb20a10a77f500f7156/setuptools-46.4.0-py3-none-any.whl (583kB)
     |████████████████████████████████| 583kB 1.0MB/s 
Collecting zipp>=0.5 (from importlib-metadata; python_version < "3.8"->jsonschema>=3.2.0->webthing>=0.12.0->-r requirements.txt (line 2))
  Downloading https://files.pythonhosted.org/packages/b2/34/bfcb43cc0ba81f527bc4f40ef41ba2ff4080e047acb0586b56b3d017ace4/zipp-3.1.0-py3-none-any.whl
Installing collected packages: python-mpd2, ifaddr, zeroconf, pyee, six, attrs, zipp, importlib-metadata, pyrsistent, setuptools, jsonschema, tornado, webthing
  Running setup.py install for ifaddr ... done
  Running setup.py install for pyrsistent ... done
  Running setup.py install for tornado ... done
Successfully installed attrs-19.3.0 ifaddr-0.1.6 importlib-metadata-1.6.0 jsonschema-3.2.0 pyee-7.0.2 pyrsistent-0.16.0 python-mpd2-1.0.0 setuptools-46.4.0 six-1.14.0 tornado-6.0.4 webthing-0.13.0 zeroconf-0.26.1 zipp-3.1.0
Failed to connect to MPD
root@openwrt:~/mpd-webthing/python# python3 mpd-webthing.py 
Traceback (most recent call last):
  File "mpd-webthing.py", line 3, in <module>
    from mpd import CommandError, MPDClient
  File "/usr/lib/python3.7/site-packages/mpd.py", line 399
    except socket.error, err:
                       ^
SyntaxError: invalid syntax

Do you know where to report that correctly? Or determine if its device/OS related?

mrstegeman commented 4 years ago

It looks like the python-mpd2 module is incompatible with Python 3.7.

novski commented 4 years ago

I asked if python-mpd2 can be made >v3.4 suitable. https://github.com/Mic92/python-mpd2/issues/116#issue-621236278

mrstegeman commented 4 years ago

It looks like there's actually a newer version on GitHub than there is on PyPI. Could you try updating?

pip3 install -U "git+https://github.com/Mic92/python-mpd2@v1.1.0#egg=python-mpd2"
novski commented 4 years ago

Yes that does help.

Now I only get Failed to connect to MPD but no socket error more.

mrstegeman commented 4 years ago

Ok, good. Make sure you have mpd running in the background. The code will try to connect to localhost:6600. You can change that, if necessary, inside mpd-webthing.py, in the __init__() method of MPDThing.