ImportError: No module named websocket
Closed this issue · 3 comments
Hi all,
after install the mopidy-json-client written in the readme description.
Using the simpe example below I got this fault on the CLI Ubuntu:
./mopidyevent.py
Traceback (most recent call last):
File "./mopidyevent.py", line 4, in
from mopidy_json_client import MopidyClient
File "/usr/local/lib/python2.7/dist-packages/mopidy_json_client/init.py", line 6, in
from .client import MopidyClient, SimpleClient
File "/usr/local/lib/python2.7/dist-packages/mopidy_json_client/client.py", line 5, in
import websocket
ImportError: No module named websocket
#!/usr/bin/python
import time
from mopidy_json_client import MopidyClient
def print_track_info(tl_track):
track = tl_track.get('track') if tl_track else None
if not track:
print 'No Track'
return
trackinfo = {
'name': track.get('name'),
'artists': ', '.join([artist.get('name') for artist in track.get('artists')])
}
print('Now playing: {artists} - {name}'.format(**trackinfo))
mopidy = MopidyClient()
mopidy.bind_event('track_playback_started', print_track_info)
if name == 'main':
# Main loop
try:
while True:
time.sleep(0.2)
except KeyboardInterrupt:
pass
Hi @ADSANG2k18!
You're right. This package has a dependency on the module websocket
, but I've not included it yet in the setup file, so it is not installed by default. I'll try to fix that.
In the meantime, try installing it with:
sudo pip install websocket
and tell me if it works.
Thanks for your issue.
for future reference: you will also need to install websocket-client
i thought this repo was dead.
i just translated my repo yesterday to use websocket-client as this was broken and now you turn out to be alive :)