[GH-ISSUE #381] Can't get many of the spotipy.Spotify features to work #223

Closed
opened 2026-02-27 23:21:28 +03:00 by kerem · 1 comment
Owner

Originally created by @aced125 on GitHub (Jun 10, 2019).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/381

Here is my code

scope = 'user-library-read playlist-read-private playlist-modify-private playlist-modify-public playlist-read-collaborative'

token = util.prompt_for_user_token(username,
client_id='client_id', 
client_secret='client_secret',
redirect_uri='http://localhost/',
scope = scope)

if token:
    sp = spotipy.Spotify(auth=token)
    res = sp.current_user_saved_tracks()
    first_track_name = res['items'][0]['track']['name']
    print(first_track_name)
    
    
    print(sp.user_playlists(username))

So it prints the first track name of the user (which is called 'Diversion') but then prints this for the next print command which I don't think it should be...

warning:couldn't write token cache to .cache-217plpxgwl26mxqkdifiyrndy?si=9cHjQNLQQOGzJQ6OuieIgQ

Diversion
{'display_name': 'Laksh Aithani', 'external_urls': {'spotify': 'https://open.spotify.com/user/217plpxgwl26mxqkdifiyrndy'}, 'followers': {'href': None, 'total': 89}, 'href': 'https://api.spotify.com/v1/users/217plpxgwl26mxqkdifiyrndy', 'id': '217plpxgwl26mxqkdifiyrndy', 'images': [{'height': None, 'url': 'https://scontent.xx.fbcdn.net/v/t1.0-1/c1.0.200.200a/p200x200/25446265_1914144571990223_7905029975795611903_n.jpg?_nc_cat=108&_nc_ht=scontent.xx&oh=605e6068f84c31989a57e9ba0fa0610f&oe=5D9B2D3F', 'width': None}], 'type': 'user', 'uri': 'spotify:user:217plpxgwl26mxqkdifiyrndy'}

Originally created by @aced125 on GitHub (Jun 10, 2019). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/381 Here is my code ``` scope = 'user-library-read playlist-read-private playlist-modify-private playlist-modify-public playlist-read-collaborative' token = util.prompt_for_user_token(username, client_id='client_id', client_secret='client_secret', redirect_uri='http://localhost/', scope = scope) if token: sp = spotipy.Spotify(auth=token) res = sp.current_user_saved_tracks() first_track_name = res['items'][0]['track']['name'] print(first_track_name) print(sp.user_playlists(username)) ``` So it prints the first track name of the user (which is called 'Diversion') but then prints this for the next print command which I don't think it should be... > warning:couldn't write token cache to .cache-217plpxgwl26mxqkdifiyrndy?si=9cHjQNLQQOGzJQ6OuieIgQ > > Diversion > {'display_name': 'Laksh Aithani', 'external_urls': {'spotify': 'https://open.spotify.com/user/217plpxgwl26mxqkdifiyrndy'}, 'followers': {'href': None, 'total': 89}, 'href': 'https://api.spotify.com/v1/users/217plpxgwl26mxqkdifiyrndy', 'id': '217plpxgwl26mxqkdifiyrndy', 'images': [{'height': None, 'url': 'https://scontent.xx.fbcdn.net/v/t1.0-1/c1.0.200.200a/p200x200/25446265_1914144571990223_7905029975795611903_n.jpg?_nc_cat=108&_nc_ht=scontent.xx&oh=605e6068f84c31989a57e9ba0fa0610f&oe=5D9B2D3F', 'width': None}], 'type': 'user', 'uri': 'spotify:user:217plpxgwl26mxqkdifiyrndy'}
kerem closed this issue 2026-02-27 23:21:28 +03:00
Author
Owner

@stephanebruckert commented on GitHub (Jan 12, 2020):

self.spotify.user_playlists("my-username"))

works for me. I get a list of playlists in return, not a user object. Closing this for now as it's 6 months old, but please feel free to re-open if this is still happening. Thanks

<!-- gh-comment-id:573406878 --> @stephanebruckert commented on GitHub (Jan 12, 2020): self.spotify.user_playlists("my-username")) works for me. I get a list of playlists in return, not a user object. Closing this for now as it's 6 months old, but please feel free to re-open if this is still happening. Thanks
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/spotipy#223
No description provided.