Home > database >  Why won't my Python code connect to Spotify's API?
Why won't my Python code connect to Spotify's API?

Time:10-03

I am trying to connect to Spotify's API in Python on Idle and I keep running into this error. My friend tested my code on her laptop and it compiled correctly, but it won't work when I run it. This is my code (My client and secret id are covered) and the output:

python error

It says there is no Spotipy module, but I can confirm that I installed it in my command center and restarted my laptop, but it still won't recognize it as a module. Why am I getting this error if the code works on my friends laptop? This is the output I should be getting:

output

CodePudding user response:

if you installed with pip. it could be you have to do:

pip3 install spotipy

rather than

pip install spotipy

hope this helps

CodePudding user response:

Please copy and paste the actual text of both code and tracebacks into your question.

Import errors are from python, not IDLE. In this case, import spotipy fails because there is no spotipy module installed for the python you are running, which is 3.10.7. On Windows, run py -3.7 -m pip install spotipy in Command Prompt. (This assume that you do no have more than one 3.10 installed and that py -3.10 does not run the one other than the one you use to run IDLE.)

  • Related