OberstVonGatow / SpotifyReorder

Reorder Spotify Playlists

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

No handlers could be found for logger "spotipy.client"

pimseb opened this issue · comments

Hello,

I just upraded from Linux Mint 19 to Linux Mint 20 but now the script doesn't work anymore.
What I did is installing python 2.7, installing spotipy with pip command.
The ReSort.py script is still in my home directory I didn't touch this directory during mint upgrade.
But now I got this error

(435, u'Paris Hilton', u'I Blame You')
No handlers could be found for logger "spotipy.client"
Traceback (most recent call last):
  File "resort.py", line 46, in <module>
    counter = check_tracks(tracks, first_date, counter)
  File "resort.py", line 13, in check_tracks
    sp.user_playlist_reorder_tracks(username,playlist['id'],counter,0)
  File "/home/pim/.local/lib/python2.7/site-packages/spotipy/client.py", line 875, in user_playlist_reorder_tracks
    snapshot_id)
  File "/home/pim/.local/lib/python2.7/site-packages/spotipy/client.py", line 1070, in playlist_reorder_items
    "playlists/%s/tracks" % (plid), payload=payload
  File "/home/pim/.local/lib/python2.7/site-packages/spotipy/client.py", line 306, in _put
    return self._internal_call("PUT", url, payload, kwargs)
  File "/home/pim/.local/lib/python2.7/site-packages/spotipy/client.py", line 266, in _internal_call
    headers=response.headers,
spotipy.exceptions.SpotifyException: http status: 400, code:-1 - https://api.spotify.com/v1/playlists/7xxxxxxxxxxxxxxxxt/tracks:
 Invalid range_length parameter: 0, reason: None

How can I fix it ?
Thank you

Got the same error yesterday. Looks like the spotipy library changed the reorder method. I can fix the Script later or at least tomorrow.
If you need a quick fix change in Line 13
sp.user_playlist_reorder_tracks(username,playlist['id'],counter,0)

To
sp.user_playlist_reorder_tracks(username,playlist['id'],counter,1,0)

I thought it was my new install
Your fix did the job.
Thank you so much

You're welcome 😊
I also fixed the code in the Repo.