Highlights of my current Touch Bar present

Highlights of my current Touch Bar present

Hey,
I want to share the highlights of my currents TB present. Primary it contains stuff from GoldenChaos and AquaTouch, but I added a few useful and cool new features.
A few days ago I rediscovered the possibility of manipulate the TB with BTT. I use BTT every day for trackpad and keyboard shortcuts, but my TB present was quite old and the last GoldenChaos version was from December 2017 or something... So I spend the last 3 days to change my present completely and optimised things for my own workflow.
Please feel free to make any suggestions and improvements for my scripts!

Add Current Song to Specific Spotify Playlist

Definitely my personal gem. Especially the story behind the coding... I'm not that into python and it took me almost a whole day to get things work correctly. There are two scripts for this kind of service needed. It now takes place in the "Now Playing Actions" from GoldenChaos.
I only enumerate my Playlists. This is what it looks like:

AppleScript

tell application "Spotify"
set currentTrackID to id of current track as string
--- insert ID of your playlist --- 
set playlistID to "PLAYLIST_ID" as string 

tell application "Terminal"
    --- insert path of python script --- 
	do script "python -I 'PATH_TO_FILE' " & playlistID & " " & currentTrackID & " " in window 1
    --- COMMENT FOLLOWING LINES AT FIRST RUN --- 
	do script "quit()" in window 1
	delay 0.5
	quit
    --- --- --- 
end tell
end tell

PythonScript

import pprint
import sys

import spotipy
import spotipy.util as util

#export SPOTIPY_CLIENT_ID='MY_CLIENT_ID'
#export SPOTIPY_CLIENT_SECRET='MY_CLIENT_SECRET'
#export SPOTIPY_REDIRECT_URI='http://localhost'

#if len(sys.argv) > 3:
username = "lowrents.d"
playlist_id = sys.argv[1]
track_ids = [sys.argv[2]]

print("Playlist: " + playlist_id)
print("Tracks:")
for p in track_ids: 
print p
            
#print sys.argv[0]
#print sys.argv[1]
#else:
#print("Usage: %s username playlist_id track_id ..." % (sys.argv[0],))
#sys.exit()

scope = 'playlist-modify-public'
token =     util.prompt_for_user_token(username,scope,client_id='MY_CLIENT_ID',client_secret='MY_CLIENT_SECRET',redirect_uri='http://localhost')

if token:
    sp = spotipy.Spotify(auth=token)
    sp.trace = False
    results = sp.user_playlist_add_tracks(username, playlist_id, track_ids)
    print(results)
    print("done!")
else:
    print("Can't get token for", username)
os._exit(0)

You have to create a new ClientID and a developer account: https://developer.spotify.com/dashboard/applications

For the first run you have to comment some lines in the AppleScript! There is some interaction needed at the Terminal. I'm not sure if there is some special handle for the python script when it runs for the first time. This is the only function wich a set up almost 2 years ago. Hope this won't be a big hassle. Please let me know if there are any problems.

Finder Dual Pane

I used to work with two open finder windows side by side, when I clean up my Desktop and Downloads folder. This helps me to arrange the windows. It also respects if the dock is hidden.

AppleScript

tell application "System Events"
if autohide of dock preferences is false then
	tell process "Dock"
		set dock_dimensions to size in list 1
		set dock_height to item 2 of dock_dimensions
	end tell
else
	set dock_height to 0
end if
end tell

tell application "Finder"
activate
if exists window 1 then
	
	set the collapsed of windows to false
	if not (exists window 2) then
		tell application "System Events"
			keystroke "n" using {command down}
		end tell
	end if
else
	tell application "System Events"
		keystroke "n" using {command down}
		keystroke "n" using {command down}
	end tell
end if

set screen_resolution to bounds of window of desktop
set screen_width to item 3 of screen_resolution
set screen_height to item 4 of screen_resolution

set left_bound to 0
set right_bound to screen_width / 2
set bottom_bound to screen_height - dock_height
set top_bound to 22 (* for the menu bar *)

set the bounds of the first window to {left_bound, top_bound, right_bound, bottom_bound}
set the bounds of the second window to {right_bound, top_bound, screen_width, bottom_bound}
end tell

There is one thing to improve, perhaps someone can help:
If a Finder window open on an other desktop that I'm working on, it won't gather the windows. It ended up with two half-screen windows on two different desktops. I didn't find any solution for changing the desktop of an active window...

Sleep Button

My own improved sleep button: it warns me when it gets clicked (to avoid missklicks). Now I have 2 seconds to react before it starts the screensaver by default (great pleasure in combination with Aerial

AppleScript

set theDialogText to "going to sleep..."
display dialog theDialogText buttons {"nope"} default button "nope" cancel button "nope" giving up after 2
if gave up of result = true then
tell application "System Events"
	start current screen saver
end tell
end if

MacStats

Basically it was only copy paste the best thing of several scripts. Do you have any Ideas for a second line of the GPU stats. I can't find any command for display the current GPU load oder VRAM usage...Here is what it looks like:

Also mind the the assigned actions!
macStats_lowrents.bttpreset (95.6 KB)

Add custom Tags

The last thing I would love to share drove me crazy last night. In the end I was more than happy that everything runs as it should, but I think there are a few things to improve... I'm not that good to handle stings.
But first there is a general question @Andreas_Hegenberg:
I tried to rebuild the apple-like tag menu, but it wasn't possible. Can BTT only use 33px (or was ist 35px) of the TB instead of the whole hight? Comparing these two screenshots may clarify my confusion:
BTT
tags_btt
Apple TB
tags_apl


This is the code for tagging the current selected finder file:

AppleScript

use AppleScript version "2.4" -- Yosemite (10.10) or later
use scripting additions
use framework "Foundation"

on addTagToPath(theTag, thePath)
set theURL to current application's NSURL's fileURLWithPath:thePath
set {success, tagArray, theError} to theURL's getResourceValue:(specifier) forKey:(current application's NSURLTagNamesKey) |error|:(specifier)
if theError is not missing value then error theError's localizedDescription() as text
if tagArray is not missing value and (tagArray's containsObject:theTag) as boolean is true then return
if tagArray is missing value then set tagArray to current application's NSMutableArray's array()
tagArray's addObject:theTag
set {success, theError} to theURL's setResourceValue:tagArray forKey:(current application's NSURLTagNamesKey) |error|:(specifier)
if theError is not missing value then error theError's localizedDescription() as text
end addTagToPath

tell application "Finder"
set finderSelList to selection as alias list
set finderSelList to finderSelList as text 
--- Here I have to cut out the name of my disk which is "MacHD" ---
--- maybe you have to change the number to match your case ---
set finderSelList to text 7 thru -1 of (get text of finderSelList)
set finderSelList to do shell script "sed 's|" & quoted form of ":" & "|" & quoted form of "/" & "|g' <<< " & quoted form of finderSelList
end tell
try
--insert TAG NAME--
addTagToPath("TAG_NAME", "/" & finderSelList)
on error e
log e
end try

Unfortunately I don't understand the 'edit string' things (especially the terminal stuff) good enough for shorten and improve this script. Especially a more automatic string editing would be nice, but my skills are not sufficient.

Thanks for tips and suggestions!

Hi! Thank you for these highlights.
Im having a hard time to get the Spotify one working.

Could you please help?
I censored a few informations for obvious reasons.

Kind regards

Hi,

first of all, sorry for the late response. I had a lot of exams and after that a view weeks vacation. I'l be now able to react quicker.

Do you solve your problem? Unfortunately these lines (7,8,9) are commented and don't remember if they have to be uncommented or not. The setup was around a year ago.

Do you have any further information from any kind of troubleshoot?

What's about the other features, do you have any other kind of problems or tested any other highlight?

Kind regards

heyyy
I've been trying to find a playlist function for Spotify, and I found you! I just don't quite understand how to add it to my own preset? can you please walk me through it? I am very bad at coding and things like that, so in-depth explanations are helpful :slight_smile:
thanks

Hey,
finally someone is interesting in this feature, so it would be a pleasure to help you :slight_smile:
I try to explain the steps, but I think to get things working I need your feedback what's working and what's not...

First of all you need a Spotify developer account (see link above)
In BTT you have to set up a Touch Bar widget:


The code for the "advanced configuration" on the left ist the following. It preserves that the buttons only are shown if Spotify is running. If its running the "06" is returned and the button appears.

tell application "BetterTouchTool"
 try
	#set showMediaControls to get_string_variable "showMediaControls"
	set currentlyPlayingApp to get_string_variable "BTTCurrentlyPlayingApp"
	#set playerstate to get_number_variable "BTTCurrentlyPlaying"
end try
end tell
#return currentlyPlayingApp
if currentlyPlayingApp is "com.apple.Safari" then
return ""
else if application "Spotify" is running then
tell application "Spotify"
	try
		set playState to (player state as text)
		if playState is equal to "paused" then
			return ""
		else
			return "06"
		end if
	end try
end tell
else
return ""
end if

For the predefined action you need to copy the AppleScript (see above). There you have to insert your PLAYLIST_ID. You can copy it by right click on the playlist –> Share –> Spotify URI.
It should be look like this:

 spotify:user:YOUR_USERNAME:playlist:3e3LKYhHGjp4dmLBIxbZBr6 

You have to create a new file with a text Editor and copy the PythonScript (see above). It could be stored anywhere but the path is needed in the AppleScript, so be aware of moving the file. The AppleScript needs to know where to look for the PythonScript so you have to add the right path and replace the
'PATH_TO_FILE' in line 8. On macOS you can copy the path of a file with cmd + option + c beware of space bars in the path

Line 10/11/12 in the AppleScript need to be commented at the first run (ad --- for comments).
These lines suppress the terminal from opening and let the whole script running in the background. But at the first run you need to copy something from the terminal into the python script. So suppressing the terminal window won't be helpful. For future usage you uncomment these lines.

Let's have a look on the python script:
to get this working you need the spotipy library: https://github.com/plamere/spotipy
Back to my python script:
In Line 13 you have to insert your Spotify username
In Line 29 you have to insert your client_id and the client_secret. I don't exactly remberes where these are coming from... I think you get this from Spotify after you create a developer account and register a new application or these are coming from the terminal when you run tis whole thing the first time
The redirected_uri don't have to be edited.

Hopefully this helps, please let me know if you get stuck and need some more advise. I think I am missing something....

Cheers :call_me_hand:t3:

also, how do I 'comment' these lines?

ok, I think I got it.

this is the coding:
tell application "Spotify"
set currentTrackID to id of current track as string
--- insert ID of your playlist ---
set playlistID to "spotify:playlist:1JjhgpBslAuhTSTRYXezFv" as string

tell application "Terminal"
--- insert path of python script ---
do script "python -I '/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presets/spotify playlist coding.rtf' " & playlistID & " " & currentTrackID & " " in window 1
--- COMMENT FOLLOWING LINES AT FIRST RUN ---
do script "quit()" in window 1
delay 0.5
quit
--- --- ---
end tell
end tell

is that all correct to you?

and also, the terminal flashes, then closes when I activate it. I took a screenshot of what is says. is that all normal?

this doesn't seem to be working for me.
thanks

you can comments lines in AppleScript by using 3 dashes (---) for single line comment oder by adding (* YOUR_COMMENT *) for multi line comment.
for more information: Apple Developer Documentation

The terminal flashes because of the lines, which has to be commented at the first run.

Do you installed the spotipy library? (see GitHub link above) Otherwise python don't no the option -i.

The second problem is the file itself. It has to be unformatted text and not rich text format. The extension of the file needs also to be .py instead .rtf
Try to rename the files extensions. If they are not shown in the finder, go to finders preferences by pressing cmd + , go to "Advanced" and then select the first box.
image

An alternative is to use the terminal for this step by typing:
sudo nano "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presents/spotify playlist coding.py"

sudo lets you start nano as an admin, you have to type in you password to continue.
nano is a terminal text editor. you can paste the python script there. save the file with control+o (letter O not the number zero) confirm with enter and exit nano with control+x

hope that helps, let me know how it's going on

im sorry, I still don't understand. am I supposed to write '---' in the code for first run somewhere? where do I do that?

yep ive installed 'Spotipy'
it put these files on my laptop:
spotipy
what do i do with them now?

ive just renamed the file to .py
i dont know if it worked:
spotpiy code scrnsht
it is named .py but it show 'rtf' on the thumbnail

i tried doing the nano thing, but it came back with this:
zsh: no such file or directory: /Users/samhumphreys/Library/Mobile

samhumphreys@Ruths-MacBook-Pro ~ %

am i doing something wrong?

edit:
I tried the sudo nano thing again, and it came back with this:
"samhumphreys is not in the sudoers file. This incident will be reported."

edit2:
I just changed the python coding into Atom, then use that file. will that help (yes, it is still .py format).

thanks

You have to comment these lines in the AppleScript:

--- COMMENT FOLLOWING LINES AT FIRST RUN ---
do script "quit()" in window 1
delay 0.5
quit
--- --- ---

These lines will prevent the terminal window from flashing in the foreground if you run the script. But at the first run you have to take a look at the terminal window and its output.
The AppleScript will look like this:

tell application "Spotify"
set currentTrackID to id of current track as string
--- insert ID of your playlist --- 
set playlistID to "PLAYLIST_ID" as string 

   tell application "Terminal"
    --- insert path of python script --- 
	do script "python -I 'PATH_TO_FILE' " & playlistID & " " & currentTrackID & " " in window 1
    --- COMMENT FOLLOWING LINES AT FIRST RUN --- 
	--- do script "quit()" in window 1
	--- delay 0.5
	--- quit
    --- --- --- 
   end tell
end tell

When everything is set up correctly you can uncomment the lines again.

You don't have to do anything with the files. It is a library which necessary to run the python script.
The fourth an fifth line of the python script will import this library. If you don't install Spotipy these line will cause an error.

[...]

import spotipy
import spotipy.util as util

[...]

Let's test if Spotipy is installed correctly: Open the terminal an start python by typing:

python

The Terminal will show something like that:

Python 2.7.16 (default, Jan 27 2020, 04:46:15) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.37.14)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> 

Then type:

import spotipy

If spotipy is not installed correctly this will cause an error, something like:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: No module named spotipy

If its installed correctly it will shown noting than a new line beginning with >>>

That's because of the spacebars in the path of the file (at Mobile Documents). The terminal stops reading the path after the first spacebar (that's why programmers dont use space bars and replace them by dash - or underscore _.
Because of the spacebar you have to quote the whole path with double quotes.
"/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presents/spotify playlist coding.py"

or you can replace the space with a backslash without the quotes so that the path will look like this:

/Users/samhumphreys/Library/Mobile\ Documents/com~apple~CloudDocs/2020/BTT Presents/spotify\ playlist\ coding.py

It looks like you are not the only user who is using the MacBook and your user don't have root privileges. Before digging deeper in to that... Creating the file with Atom works correctly, right?

Where are you standing now? What's next? :slight_smile:

ok,

Terminal

when I type 'python' in terminal, it comes back with this:
WARNING: Python 2.7 is not recommended.

This version is included in macOS for compatibility with legacy software.

Future versions of macOS will not include Python 2.7.

Instead, it is recommended that you transition to using 'python3' from within Terminal.

Python 2.7.16 (default, Feb 29 2020, 01:55:37)

[GCC 4.2.1 Compatible Apple LLVM 11.0.3 (clang-1103.0.29.20) (-macos10.15-objc- on darwin

Type "help", "copyright", "credits" or "license" for more information.

is this correct?

also, this is coming uo when I type 'import Spotipy':
Traceback (most recent call last):
File "", line 1, in
ImportError: No module named spotipy

why is this happening? should I zip the Spotipy file?

Also, Terminal is not opening when I press 'Run Script'.

Space

I added double quotes around the path, so the code now looks like this:
tell application "Spotify"
set currentTrackID to id of current track as string
--- insert ID of your playlist ---
set playlistID to "spotify:playlist:1JjhgpBslAuhTSTRYXezFv" as string

tell application "Terminal"
--- insert path of python script ---
do script "python -I '"/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presets/spotifywidgetcode.py"' " & playlistID & " " & currentTrackID & " " in window 1
--- COMMENT FOLLOWING LINES AT FIRST RUN ---
--- do script "quit()" in window 1
delay 0.5
quit ---
--- --- ---
end tell
end tell

Atom

I am not sure if the file with Atom works correctly. How can I test this?

Thanks very much. If this works, I'll be EXTREMELY happy :smiley::smiley::smiley:

Python 2.7 is not the most recent version and it is recommended to use python 3 instead. But this should not cause any problems.

Why? because spotipy is not installed. You can check this by listing all installed modules:
python -c 'help("modules")'

If spotipy is missing you have to install it by typing:

pip install spotipy

you mean when you press "run script" in BTT script editor?
Try to debug the AppleScript with apples native app: "Script Editor". This will give you a more informative console output.

  1. open spotlight by pressing cmd + spacebar
  2. type in "script editor"
  3. create a new file by pressing cmd +n
  4. paste the AppleScript
  5. press the hammer icon, to compile the script.

If there is anything wrong, a message box will appear and shows you the error.
I think we still have a problem with the path... sorry for misleading you! My explanation for setting the path in-between double quotes was for the terminal sudo nano command
AppleScript accept single quotes ' for a path.

So the script will look like this:

tell application "Spotify"
	set currentTrackID to id of current track as string
	set playlistID to "spotify:user:lowrents:playlist:5eCCewHsK1JZfHqz4CctrG" as string 
	
	tell application "Terminal"
		do script "python -i '/Users/samhumphreys/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/spotify/test.py' " & playlistID & " " & currentTrackID & " " in window 1
		do script "quit()" in window 1
		delay 0.5
		quit
	end tell
end tell

I just realised that you playlist ID Looks different. Mine also stores the username
spotify:user:YOUR_USERNAME:playlist:61AN9qEcP1kjOkz52GegNL
instead of:
spotify:playlist:61AN9qEcP1kjOkz52GegNL
I don't know if this causes any problems. To make sure that we are on the same page, add you username so that you playlist ID will look like mine

you can run python scripts by typing:
python PATH_TO_FILE
if this works, the script is correct.
In the past we had a few problems with the correct path :smiley: so instead of typing the whole path to your python script you can:

  1. open you desired folder with finder
  2. make sure that you select the folder (blue highlight)
  3. in the menu bar, go to Finder -> Services -> New Terminal at folder

If this option doesn't appear, you don't have selected the folder. If the terminal window opens, you should see the name of the folder. you can double check if you are in the correct folder by typing ls which lists all files in the current folder.

If you are in the correct folder you can run your python script with:

python spotifywidgetcode.py

the output should be something like this:

Traceback (most recent call last):
  File "spotifywidgetcode.py", line 14, in <module>
    playlist_id = sys.argv[1]
IndexError: list index out of range

Let me know if this works and what the terminal says.

PS: for syntax highlighting you can define blocks of code by typing ``` before an after the code.

No, Spotipy is not downloaded, which is weird. I downloaded it from the GitHub link you sent, and have the files on my Mac.
I typed in 'pip install Spotipy' and it returned:
Last login: Tue May 26 07:56:36 on ttys000

samhumphreys@Ruths-MacBook-Pro ~ % pip install spotipy

zsh: command not found: pip

samhumphreys@Ruths-MacBook-Pro ~ %

================

when I compile the code, it says this:

when I press OK:

=================

when I typed in 'python PATH_TO_FILE', (I assume in Terminal?) it came back with this:
samhumphreys@Ruths-MacBook-Pro ~ % python /Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presets/spotifywidgetcode.py

/System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python: can't open file '/Users/samhumphreys/Library/Mobile': [Errno 2] No such file or directory

samhumphreys@Ruths-MacBook-Pro ~ %

===============

I tried the new terminal at folder thing:

I couldnt find it :frowning:

========================

thanks

Downloading and installing are two different things. You have to install it properly, so that Python recognise, that Spotipy is "there". I run a different version of macOS (Mojave). Regarding your terminal output, you are running Catalina. Apple changed a few things here. Try to follow this guide to install pip. Hopefully it will works with the command:

sudo easy_install pip

keep in mind that you are not the admin user. you can switch the account manually ( for example logging off with: cmd+⇧+Q and logging in with the other account) or you can witch the user in terminal by:

su ADMIN_USER_ACCOUNT_NAME

further information for running sudo command from non-admin account.

The problem occurs because of the spacebars in the path. That's why Documents is highlighted, it stops reading the line.
As I said before: AppleScript accept single quotes if you have spacebars in a path. Your AppleScript will look like this:

tell application "Spotify"
	set currentTrackID to id of current track as string
	set playlistID to "spotify:user:lowrents:playlist:5eCCewHsK1JZfHqz4CctrG" as string 
	
	tell application "Terminal"
		do script "python -i '/Users/samhumphreys/Library/Mobile Documents/com~apple~ScriptEditor2/Documents/spotify/test.py' " & playlistID & " " & currentTrackID & " " in window 1
		---do script "quit()" in window 1
		---delay 0.5
		---quit
	end tell
end tell

Also because of the spacebar, so the terminal stops reading after Mobile. Terminal should accept single and double quotes for paths.

python "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presets/spotifywidgetcode.py"

or

python '/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presets/spotifywidgetcode.py'

Keep in min that we want to test the python script. So if this (above) will work, you don't have to try the following "terminal at folder"-thing.

Please read properly above. You have to make sure that you selected the folder, not the file. Go one hierarchy back, select the folder and the option should appear. My default view in finder is "column view" so it will look a bit different:
image
image

Hopefully this will helps.

hi

Installing pip

I did what the link told me to do, and this happened. I guess I have to update python? how do I do that?

also, what will using the admin user do? can't i do this Spotify playlist in touchbar thing on my non-admin account?

Space

I added the singe quotes. I think I had put them in the wrong place before, but now they are in the right place. I compiled the script and it worked

Terminal Folder thing

I did what you said in your previous post:


im so lost :joy::sweat:

thanks

great! we are coming closer :smiley:

it seems that pip installed successfully. now you can try again to install spotipy.

pip install spotipy

double check if it's installed correctly by typing:
python -c 'help("modules")'

okay now that we know that the AppleScript is working, you can copy this in BTT.

Okay so we are now in the correct folder and can access the python script. The error you see above is because of the incorrect filetype (.rtf).
Now you can try the nano thing again.

sudo nano spotifywidget.py

If it doesn't work with sudo, try to use the command without sudo. We need a non-formatted file, which will nano creates.
Alternatively you can use a text editor (not the apple native one) like atom and create the python file.
If the python script is created try to run it by

python spotifywidget.py

keep in mind that you have to be in the folder BTT Presets

pip

I don't know what's happening.
I checked that pip was installed, and it came up when I wrote python -c 'help("modules")'
but when I ran pip install Spotipy, this showed:

sudo nano thing

I did the sudo nano spotipywidgetcode.py thing and it didn't worked. I then did it without the word sudo (nano spotipywidgetcode.py) and it came u with this:


has it worked?

Atom

I am currently using Atom for my python coding, so I tried python spotipywidgetcode.py and it returned:

thanks

Unfortunately I think I cannot help you at this point. Solving this problem remotely exceeds my capabilities since I am the only user on my MacBook. I cannot replicate "your" environment and test the same thing you have to do to get things running. Try using google to solve this problem.
I think it has something to do with the different users on the MacBook... an finally... a proper path – again :smiley: Try google the warning which is shown in your screenshot.

yep it works. A new file is created (which is shown in the bottom line). now you could paste the python script, safe the file and exit nano but I think we can skip this since you are using Atom for creating the python script. Atom and nano is kind of the same thing. Both are text editors which we want to use to create the python script.

Again, our pain in the neck... the path/ directory you are in. The path you are currently working in (with the terminal) is shown in the line:
samhumphreys@Ruths-MacBook-Pro FOLDER_YOUR_ARE_WORKING_IN %

If you take a look at your screenshot the ~ means that you are in your users home directory.
if you run python script.py the terminal tries to run the script you named (script.py) in the current directory you are in, but the script is in your "BTT Preset" folder.
So you have two possibilities: you can do the run-terminal-at-folder-thing again or you can define the hole path to you script.

python "/Users/samhumphreys/Library/Mobile Documents/com~apple~CloudDocs/2020/BTT Presets/spotifywidgetcode.py"

mind the double quotes! :smiley:

ok, sorry but so im not sure where we're at. can you no longer help me?

I am a bit confused as well and I think I was not born to write manuals. I can and will help you for sure :blush: especially since we gone this long way and many things are already working.
The only thing I can't help you with is the problem with pip/ spotipy, sorry for confusing you... and I think you have to use google for solving this. If spotipy is installed we can go further and get things working.

For your motivation: