mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-27 00:25:54 +03:00
[GH-ISSUE #1023] Can't catch spotipy.SpotifyException #607
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#607
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 @alexklann on GitHub (Aug 20, 2023).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/1023
When using an invalid album name for the query, it will throw an error that can't be caught with a try except:
@bearsyankees commented on GitHub (Aug 21, 2023):
Could you share more of your code? I am having trouble replicating this issue
@dieser-niko commented on GitHub (Aug 21, 2023):
I think the error message suggests that the problem might be somewhere else in your code..
@alexklann commented on GitHub (Aug 21, 2023):
https://pastebin.com/W2Zb39BW
Here's the source code.
I don't really think that most of it is even a factor in this issue, since I am using a return directly after calling
add_to_spotify()for debug reasons...@dieser-niko commented on GitHub (Aug 21, 2023):
So it looks like if you use an invalid album name and the
artistcan't be found in any of the results, the variableresult_album_idwill still be an empty string resulting in an error atresult_album_tracks = sp.album_tracks(result_album_id)(as the error message suggests)@alexklann commented on GitHub (Aug 21, 2023):
It seems like I removed the return that comes after the print statement in the except-clause before I uploaded the code!
It does seem to be the issue that you've found, however when I add the return statement to the except-clause, the code is never called and does not exit out of the
add_to_spotify()function.@alexklann commented on GitHub (Aug 21, 2023):
So it seems like using try-except only works when I use it inside of main() with the add_to_spotify function. I guess I don't know how python works...