-1

Earlier today I had no problem accessing the Spotipy API but all of a sudden it stopped working. When I forexample run the following:

spotipy.artist("5rSXSAkZ67PYJSvpUpkOr7")

Where 5rSXSAkZ67PYJSvpUpkOr7 is the Spotify ID of an artist, I get the error:

AttributeError: module 'spotipy' has no attribute 'artist'

The closest thing to an explanation I have found is this thread. But I don't completely understand the solution.

andKaae
  • 173
  • 1
  • 13
  • You have a file called `spotipy` in your own project. The explanation you linked tells you to rename it to something else. – h4z3 Dec 01 '20 at 13:18
  • @h4z3 I have tried to look through all my folders but I cant find a file or notebook called `spotipy`. I am using deepnote, don't know if that makes a difference? – andKaae Dec 01 '20 at 13:40
  • See the first example of the [API reference](https://spotipy.readthedocs.io/en/2.16.1/#api-reference)... – Tomerikoo Dec 01 '20 at 14:29

1 Answers1

1

Your spotify is apparently the module and not the object of spotify_obj = spotify.Spotify() class.

spotify_obj has artist attribute. spotify module does not.

Lior Cohen
  • 5,570
  • 2
  • 14
  • 30
  • I'm not sure if this was excatly my problem but it lead me to finding the problem. I accidently imported twice, so `import spotipy as sp` and `import spotipy`. Thanks! :-) – andKaae Dec 01 '20 at 14:53