0

I'm trying to access spotify via the spotipy API from a win10 pro (64Bit) system. In the spotipy documentation it says "...you can set environment variables like so:

export SPOTIPY_CLIENT_ID='your-spotify-client-id'" ...

Of cource I can use "var SPOTIPY_CLIENT_ID='your-spotify-client-id'" in my script but I'd like to know what this export command means exactly. Is that the export known from a Linux system? I set the necessary spotify variables as environment variables in Win10 but they still were unknown.

Does anyone have an idea what it means exactly and how to get it working in win10?

Thanks

delaflota
  • 159
  • 1
  • 3
  • 12

3 Answers3

2

While it is better practice to set the environment variables if you just want to get up and running you can still pass in those values into the call in your code.

token = util.prompt_for_user_token(myUsername, scope, myClientId, mySecret, myRedirect)

There is info on wikipedia about how to set them.

Also refer to this StackOverflow answer.

reefsurfer
  • 21
  • 3
0

I don't know if it will work for python scripts, but the windows commands you want would be:

SetX SPOTIPY_CLIENT_ID your-spotify-client-id

Souce: http://ss64.com/nt/setx.html

angrymatt
  • 1
  • 1
  • Thanks for your answer, @angrymatt! Though it doesn't seem to work: SetX SPOTIPY_CLIENT_ID 1234 SyntaxError: invalid syntax. But what I managed to find out is: import os and then client_id = (os.environ['SPOTIPY_CLIENT_ID']), where SPOTIPY_CLIENT_ID is a wi ndows environment variable. – delaflota Oct 30 '16 at 09:59
0

for windows 10 powershell terminal use $env: instead of export(for macs) and put your code string in quotes:

   $env:SPOTIFY_CLIENT_ID="XXXX"
artworkjpm
  • 1,255
  • 2
  • 19
  • 40