Kashi: Show Current Song Lyrics on Touch Bar (Spotify / iTunes / Youtube)

Thanks for getting back to me. Testing the print statements: all of them work and dispense the correct lyrics in terminal, which seems to suggest that the python modules are set up correctly (the path for python3 is also correct). Copying and pasting the JSON into the settings seems to create the same result: just blank Touch Bar space, not even a button as far as I can tell.

I see. Then it must be how your bar is set up. Can you make sure that the widget is checked "Visible", item placement is "Scrollable Main Container", and that no other widgets occupy the same space? Having a left and a right one is OK.

Please see below:

Widget is checked visible and item placement is a Scrollable Main Container. I turned off all my other widgets, so nothing should be interfering...

Hm, I'm a bit stumped. Thanks for your persistence.

Could you try creating the widget from scratch? Create a new "Run Shell Script And Show Return Value" script widget and confirm that it's showing text. Then copy+paste the .py script (Parameter = "-c").

Hello, really great work! I am just having some trouble getting the lyrics to scroll as the song play. If you could help that would be awesome!

Hi, trying to get this to work and I keep running into this error.

File "kashi.py", line 214, in
File "kashi.py", line 20, in main
File "kashi.py", line 135, in processPlayerData
player_artist = player_data[1].lower()

IndexError: list index out of range

Hi Bowser.

Seems like the "player_data" array is completely empty in your case. That is strange because the "getBrowserAndPlayerData" function should default values to "none" if no player or browser is running.

Which means you must be having problems with the osascript module. It is responsible for running the applescripts which get the player/browser data. Make sure that all osascript and all other Python modules are correctly installed.

The best way to do this is to test the script on command line and see if your Python spits any error about the modules. E.g., you can add the line "print(player_data)" to see what is in that list.

Also, very important is to make sure your launch path, parameter, and Python path are properly specified. For me, these are:

Launch Path:



The PYTHONPATH may vary for you depending on how your Python is installed.

1 Like

I've been trying everything I can think of. I created a new partition and reinstalled osx along with python and the modules. Everything seems to point to the right place. When playing around in idle with the module, it sees the functions and i can call them but it cant see the data. e.g. when I called printWisdom() it recognizes that it needs an input but cant seem to get one

Hi Bowser,

Sorry for the trouble you're going through.

The printWisdom function just prints a music-related quote (static data) if there are no hits from the lyrics API, so it doesn't tell much about your configuration.. The key here is that you can't see the player data. Is the py script able to spit out the player data? Try printing the variable "player_data" (or "browser_data" if it's Youtube) after line 17 and see what comes out.

I'm also unsure if your Python is configured correctly with BetterTouchTool. You can test this simply by running a script as simple as print("Testing Python") and see if it shows up on the bar.

Let me know how it goes! Feel free to post some screenshots too. If you need remote assistance, I don't mind helping you out. Just let me know.

Any chance for an updated read me for the change from iTunes to music in Catalina

I have been getting this error and I'm really confused about it if anyone can help me. I would be appreciated.
File "", line 35
"BTTTouchBarShellScriptString": "/usr/bin/python3 -m touchbar_lyric]”,
SyntaxError: EOL while scanning string literal

Hi, I'm also getting an error:

Traceback (most recent call last):
File "", line 202, in
File "", line 19, in main
File "", line 130, in processPlayerData
IndexError: list index out of range

my launch path and parameters are correct per your instructions above. Where do I enter the PYTHONPATH lines? I tried with and without that line in the second paramters input to no avail.

I'm excited for this Preset, any help would be greatly appreciated



I've cleaned up the README for Catalina and added a new section for configuring parameters as a final step. Hope it helps.


I think you are looking for https://pypi.org/project/touchbar-lyric/.


I updated the path defaults, so please try again with the updated JSON file. Launch Path no longer refers to the environment variable and directly references the install path. Also, "PYTHON=" was not necessary. I updated the README to show this.

I tried with the new JSON and got Error/Nothing was returned.

I'm running Catalina and installed python3 via homebrew.

My launch path for python3 is /usr/local/bin (determined via running which python3) and my site packages path is /usr/local/Cellar/python/3.7.5/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages which I entered in the second params line. (I followed the directions here: https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory)

I'm trying with Apple Music. I open Music, start a song then use Run Script Now in the BTT config pane.

Any suggestions on different approaches I can try? Happy to add any debug lines into the python script to help resolve


To be honest, haven't been testing with Music and wonder if it is app-specific.
Can you confirm the output for Spotify?

I'm a bit confused -- in the readme, it says to import the json file into btt... what does that mean specifically? i couldn't find any import button for json files, just licenses and presets.

Also, in the "Script:" part of the shell script/task trigger, do we paste the contents of the json file? Or of the .py file?


Sorry if the language was confusing.

BetterTouchTool allows you to import widgets by pasting in the parameters/properties in JSON format.

So by "import", it means to just copy and paste the contents of the Kashi JSON (Select All, Copy). If it doesn't show up when you paste, make sure you have focus on the trigger column pane by clicking it first.

Got it! It imported properly :slight_smile: but now having an error:

Traceback (most recent call last):
File "", line 1, in
ModuleNotFoundError: No module named 'requests'

I think this may be due to python3.8 installing instead of 3.7, could that be it? I don't think I have 3.7 installed.

Based on the new instructions for step 4 in the readme, i changed the 3 paths in BTT to be the following:

Launch Path: Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8

Parameters: -c


Any ideas for what to do here? Thanks!


The ModuleNotFoundError means you haven't installed the required modules.

You'll need to make sure the following Python package are installed: OsaScript, Requests, BeautifulSoup

To install a Python package, just type the following in your terminal. Then check the "site-packages" folder and you should be able to confirm that the package folder is there.

pip install requests


pip3 install requests
(for Python 3)

Got it! Seems like those finally installed properly.

I'm now getting another error though:

Traceback (most recent call last):
File "", line 117, in
File "", line 14, in main
IndexError: list index out of range

Any ideas? This is while trying to play a song on the Music.app that's downloaded locally to my computer

Imprint | Privacy Policy