[GH-ISSUE #210] Error occurring in prompt_for_user_token() (Python 2.7.12) #108

Closed
opened 2026-02-27 23:20:52 +03:00 by kerem · 3 comments
Owner

Originally created by @clungzta on GitHub (Aug 27, 2017).
Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/210

Hello,

The following error occurs in the prompt_for_user_token() function when using Spotipy 2.4.3 and 2.4.4.

I am currently running Python version 2.7.12. I've set the Spotify auth environment variables in my bashrc.

$python my_playlists.py [USERNAME]
Traceback (most recent call last):
  File "my_playlists.py", line 18, in <module>
    token = util.prompt_for_user_token(username, scope)
  File "/usr/local/lib/python2.7/dist-packages/spotipy/util.py", line 56, in prompt_for_user_token
    token_info = sp_oauth.get_cached_token()
  File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 135, in get_cached_token
    if 'scope' not in token_info or not self._is_scope_subset(self.scope, token_info['scope']):
  File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 156, in _is_scope_subset
    needle_scope = set(needle_scope.split())
AttributeError: 'NoneType' object has no attribute 'split'

If I revert back to Spotipy-2.3.8 this error does not occur. (but 2.3.8 is missing some functionality which is available in 2.4.4 that I would like to use)

It would be greatly appreciated if any suggestions/fixes could be provided.

Originally created by @clungzta on GitHub (Aug 27, 2017). Original GitHub issue: https://github.com/spotipy-dev/spotipy/issues/210 Hello, The following error occurs in the prompt_for_user_token() function when using Spotipy 2.4.3 and 2.4.4. I am currently running Python version 2.7.12. I've set the Spotify auth environment variables in my bashrc. ``` $python my_playlists.py [USERNAME] Traceback (most recent call last): File "my_playlists.py", line 18, in <module> token = util.prompt_for_user_token(username, scope) File "/usr/local/lib/python2.7/dist-packages/spotipy/util.py", line 56, in prompt_for_user_token token_info = sp_oauth.get_cached_token() File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 135, in get_cached_token if 'scope' not in token_info or not self._is_scope_subset(self.scope, token_info['scope']): File "/usr/local/lib/python2.7/dist-packages/spotipy/oauth2.py", line 156, in _is_scope_subset needle_scope = set(needle_scope.split()) AttributeError: 'NoneType' object has no attribute 'split' ``` If I revert back to Spotipy-2.3.8 this error does not occur. (but 2.3.8 is missing some functionality which is available in 2.4.4 that I would like to use) It would be greatly appreciated if any suggestions/fixes could be provided.
kerem closed this issue 2026-02-27 23:20:52 +03:00
Author
Owner

@HamedMP commented on GitHub (Sep 12, 2017):

I solved it with this https://github.com/plamere/spotipy/issues/194#issuecomment-317192954

<!-- gh-comment-id:328804126 --> @HamedMP commented on GitHub (Sep 12, 2017): I solved it with this https://github.com/plamere/spotipy/issues/194#issuecomment-317192954
Author
Owner

@gwynnebaer commented on GitHub (Sep 15, 2017):

Same solution worked for me.

<!-- gh-comment-id:329911491 --> @gwynnebaer commented on GitHub (Sep 15, 2017): Same solution worked for me.
Author
Owner

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

If I revert back to Spotipy-2.3.8 this error does not occur. (but 2.3.8 is missing some functionality which is available in 2.4.4 that I would like to use)

There was a bug with 2.4.4 where all the code was actually from a much older version. Please upgrade:

pip install spotipy --upgrade
<!-- gh-comment-id:573907139 --> @stephanebruckert commented on GitHub (Jan 13, 2020): > If I revert back to Spotipy-2.3.8 this error does not occur. (but 2.3.8 is missing some functionality which is available in 2.4.4 that I would like to use) There was a bug with 2.4.4 where all the code was actually from a much older version. Please upgrade: pip install spotipy --upgrade
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#108
No description provided.