From 463d6c0878cbe4ab572ba67a9381a343bc401204 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 4 Jan 2017 15:53:50 -0200 Subject: [PATCH 1/2] Update function to make it compatible to Python 3. The class `basestring` does not exist in Python 3. Change to `str`. --- spotipy/client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spotipy/client.py b/spotipy/client.py index 3348fc5..5f120b0 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -418,7 +418,7 @@ class Spotify(object): - collaborative - optional is the playlist collaborative ''' data = {} - if isinstance(name, basestring): + if isinstance(name, str): data['name'] = name if isinstance(public, bool): data['public'] = public From e2b03937e70dae73437b7ff7f7386bc1edb3ca91 Mon Sep 17 00:00:00 2001 From: Carlos Eduardo Date: Wed, 4 Jan 2017 17:20:47 -0200 Subject: [PATCH 2/2] Update client.py Added a check if basestring class exists (Python2 case). If doesn't exist, alias `basestring` to `str` (Python3 case). --- spotipy/client.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/spotipy/client.py b/spotipy/client.py index 5f120b0..d2542ab 100644 --- a/spotipy/client.py +++ b/spotipy/client.py @@ -418,7 +418,12 @@ class Spotify(object): - collaborative - optional is the playlist collaborative ''' data = {} - if isinstance(name, str): + # Add Python2 and Python3 compatibility checking string types + try: + basestring + except NameError: + basestring = str + if isinstance(name, basestring): data['name'] = name if isinstance(public, bool): data['public'] = public