mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 08:35:49 +03:00
[GH-ISSUE #1156] Fails to query audio features for LOCAL track files that aren't available #681
Labels
No labels
api-bug
bug
dependencies
documentation
duplicate
enhancement
external-ide
headless-mode
implicit-grant-flow
invalid
missing-endpoint
pr-welcome
private-api
pull-request
question
spotipy3
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/spotipy#681
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @tprebenda on GitHub (Aug 21, 2024).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1156
Describe the bug
When a playlist contains LOCAL track files (uploaded to Spotify by a user), specifically ones that are greyed out in the Spotify app (no longer available?), Spotipy will retrieve them when querying a playlist, but it will then error out when trying to query audio features for those songs.
Error:
TypeError: expected string or bytes-like object(presumably because local track files don't contain the expected values used by Spotipy internally?)Your code
Expected behavior
Local files should be skipped completely (not retrieved when querying playlist tracks), or they should be skipped when querying audio features
Output
Environment:
@dieser-niko commented on GitHub (Aug 21, 2024):
I don't think that it should be skipped/ignored as this might confuse others even more. However, I'd say that the error is a bit too vague. I just wouldn't expect this kind of error message.
@tprebenda commented on GitHub (Aug 21, 2024):
Confuse others more? How so?
If we don't skip them, Spotipy will error out every time it tries to query for Audio Features for local tracks. Local tracks are common enough on Spotify that Spotipy should be able to handle it properly...
@dieser-niko commented on GitHub (Aug 21, 2024):
If Spotipy ignored this, other people might come across it and suspect that it just doesn't work, rather than getting an error telling them what's wrong. In my opinion it's the programmer's responsibility to ensure that the track is not local.
Also I've debugged your code and it seems that the ID of a local track is None. A possible quick fix would be:
@tprebenda commented on GitHub (Aug 22, 2024):
Fair enough, then the error message should definitely be more clear about the source.
Also thanks, I already handled it :)
@dieser-niko commented on GitHub (Aug 22, 2024):
In this case the error message should be fine as one of the inputs was not an expected type.
I'm going to close the issue as it seems to be resolved.
@tprebenda commented on GitHub (Aug 22, 2024):
I definitely think it'd be worth improving the error message from Spotipy for this particular type error, but understood.