mirror of
https://github.com/spotipy-dev/spotipy.git
synced 2026-04-26 16:15:51 +03:00
[GH-ISSUE #176] AttributeError: 'NoneType' object has no attribute 'split' when calling util.prompt_for_user_token with a cached token of None scope #89
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#89
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 @jj1118 on GitHub (Mar 29, 2017).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/176
Minimal example:
(Note
scope=Noneis default forutil.prompt_for_user_token())Traceback:
This breaks the program when being runned a second time with existence of cache on disk, which previously (back before last December I believe) did not happen.
@sachag678 commented on GitHub (Apr 2, 2017):
I am having the same issue. It worked the first time but it fails the second time,
@anirudh3 commented on GitHub (Apr 11, 2017):
Got the same issue!
I think this might be a bug. If we don't pass a valid scope the first time a user token is generated and authorized successfully, then from next time onwards, the get_cached_token() function is susceptible to returning 'None' (line 135 in oauth2.py), even if you set the scope this time. Maybe, this is it, though I need to download the library, make changes and try it out. I had used installed version till now.
@josduj commented on GitHub (Apr 24, 2017):
Use the github version, it should be fixed.
@jj1118 commented on GitHub (Apr 24, 2017):
@josduj Using Github version, now the error becomes:
@sachag678 commented on GitHub (Apr 24, 2017):
It started working for me.
I just deleted the original user token and now it works every time I use it
On Mon, Apr 24, 2017 at 3:52 AM, Jason Li notifications@github.com wrote:
@ghost commented on GitHub (May 3, 2017):
This issue is present on the "Shows the contents of every playlist owned by a user" example on the website documentation as well. fixed by setting scope='user-library-read' before prompting user token.
@ulgens commented on GitHub (Jun 11, 2017):
Simple workaround:
@diogofm commented on GitHub (Jun 17, 2017):
Thanks @ulgens , your solution worked fine for me.
@netik commented on GitHub (Jun 28, 2017):
Adding the following to _is_scope_subset in oauth2.py fixes this issue. When I initially created my oauth token I did it on a create_playlist call. It seems that this creates a token with a scope of None and that breaks parsing. This is working for me but may be an incomplete fix.
@gwynnebaer commented on GitHub (Jul 7, 2017):
I can confirm that @Perolus commit works for me.
@patalanov commented on GitHub (Aug 2, 2017):
how can one delete the original user token with None scope?
@patalanov commented on GitHub (Aug 2, 2017):
this does not work for me. why do I get syntax error in
where is this file located?
@ulgens commented on GitHub (Aug 3, 2017):
@patalanov
f strings are only supporterd after python 3.6. If you're using lower version, you should use
.format()method. File is located under same folder with the code itself.@ivancete commented on GitHub (Mar 19, 2018):
Thanks @ulgens it worked very fine.
@jfaul commented on GitHub (Apr 8, 2018):
Hey @ivancete, I'm having the same problem you had, what was the code that you inserted using the .format()? Thanks!
@wyattshapiro commented on GitHub (Sep 7, 2018):
@jfaul The line of code using .format would be
os.remove(".cache-{}".format(username))@roydemirjian commented on GitHub (Oct 16, 2018):
@ulgens worked perfectly thank you
@amirkatzster commented on GitHub (Feb 10, 2019):
A hidden file is created called .cache-{username} can be also deleted manually
@OliverPearmain commented on GitHub (Mar 17, 2019):
I was getting this problem because I wasn't passing the returned
tokenwhen instanciating thespotipy.Spotifyinstance.I was doing this....
When I should have been doing this...
@conorhennessy commented on GitHub (Mar 28, 2019):
Many thanks to @ulgens and @wyattshapiro whos fixes outlined above saved the day!
@mdreynes commented on GitHub (Aug 26, 2019):
I changed the function at line 155 with this
and it works.
Maybe I've done something wrong (I have a lot to learn in Python) but for now is working
@ezekini commented on GitHub (Feb 10, 2020):
Hello. I was using the library without any trouble, but suddenly I got the same error. I am authenticating using:
I tried deleting the hidden file without luck. I am using the latest version of the library. Any ideas on what may be happening?
@stephanebruckert commented on GitHub (Jun 26, 2021):
Closing as wontfix as
util.prompt_for_user_token()will be removed in v3