[GH-ISSUE #922] Why is it saying KeyError: 'genres' here? #551

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

Originally created by @Andrew3212 on GitHub (Dec 29, 2022).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/922

song = sp.current_user_playing_track()
gen = song['item']['artists'][0]['genres']
KeyError: 'genres'

Originally created by @Andrew3212 on GitHub (Dec 29, 2022). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/922 song = sp.current_user_playing_track() gen = song['item']['artists'][0]['genres'] KeyError: 'genres'
kerem 2026-02-27 23:23:17 +03:00
  • closed this issue
  • added the
    question
    label
Author
Owner

@Andrew3212 commented on GitHub (Dec 29, 2022):

artid = song['item']['artists'][0]['id']
artist = sp.artist(artid)
artist['genres']

this worked

<!-- gh-comment-id:1367123214 --> @Andrew3212 commented on GitHub (Dec 29, 2022): artid = song['item']['artists'][0]['id'] artist = sp.artist(artid) artist['genres'] this worked
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#551
No description provided.