ActivityWatch/aw-watcher-spotify

JSONDecodeError

ErikBjare opened this issue · 0 comments

Had run fine for a few days, then this happened...

Obviously we got a null-response somehow, might need to catch the exception and retry.

Traceback (most recent call last):...
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/erb/Programming/activitywatch/other/aw-watcher-spotify/aw_watcher_spotify/__main__.py", line 8, in <module>
    aw_watcher_spotify.main()
  File "/home/erb/Programming/activitywatch/other/aw-watcher-spotify/aw_watcher_spotify/main.py", line 114, in main
    track = get_current_track(sp)
  File "/home/erb/Programming/activitywatch/other/aw-watcher-spotify/aw_watcher_spotify/main.py", line 33, in get_current_track
    current_track = sp.current_user_playing_track()
  File "/home/erb/Programming/activitywatch/other/aw-watcher-spotify/aw_watcher_spotify/main.py", line 24, in patch_current_track
    return self._get('me/player/currently-playing')
  File "/home/erb/.local/lib/python3.5/site-packages/spotipy/client.py", line 146, in _get
    return self._internal_call('GET', url, payload, kwargs)
  File "/home/erb/.local/lib/python3.5/site-packages/spotipy/client.py", line 123, in _internal_call
    -1, '%s:\n %s' % (r.url, r.json()['error']['message']),
  File "/home/erb/.local/lib/python3.5/site-packages/requests/models.py", line 885, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3.5/json/__init__.py", line 319, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.5/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.5/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)