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

I receive the same errors no matter which instance the widget is calling. I do have all required packages as well as the kashi.py file in the site-packages directory

@rebelraiders101: The json file is just to easily insert the widget. All widgets on BTT can be represented in JSON. It's not necessary if you already have the widget set up. You're right in that all you need to do is paste the contents of the py file in "Script".

@jrosenkrantz: Thanks for the screen. Can you try Launch Path as "/Library/Python/3.7/lib/python" ?

Thanks for the clarification! I'm very unfamiliar with json and python (mechanical engineer not computer lol). After thinking that I got it all figured out, I'm getting this error:

Traceback (most recent call last):
File "", line 212, in
File "", line 11, in main
File "", line 103, in getBrowserAndPlayerData
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/osascript/init.py", line 14, in run
path = temp.tempfile()
File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/temp/init.py", line 15, in tempfile
f, path = tempfile.mkstemp()
AttributeError: 'function' object has no attribute 'mkstemp'

I've double checked the launch path and variables path and have installed the dependencies, so I'm not sure what's going on. I would really appreciate any help with this! :slight_smile:

That path is progress... not receiving the same error, only "Error/Nothing was returned"

how do I download python 3?

I can't remember for sure but Python 3 is included with the Catalina build, or if not then definitely with Xcode. You can also download it from python.org or install with homebrew in Terminal

brew install python3

in Terminal, which python3 which will return the current version and whereis python3 will return the location

Hi
This returns
zsh: command not found: brew
Thanks

You will need to install the Homebrew package manager from https://brew.sh

1 Like

I've never seen that error, and it may be a new bug.

If you want to try to debug the temp module's init.py file yourself, you can just open it in a text editor. The bug seems to be a basic name conflict for the word "tempfile".

"tempfile" is imported as a module with that name:

import tempfile

But then the code tries to define a function also under the same name:

def tempfile():
    f, path = tempfile.mkstemp()
    os.close(f)
    return path

This creates a conflict. When the osascript dependency tries to interpret path = temp.tempfile() it calls into this function and can't find the correct "tempfile" reference, causing the error.

To remove the error, I would first rename the imported module to a different name:

import tempfile as tempfilelib

Then I would change all instances of tempfile in init.py EXCEPT the function name to the new name, so the previous function may look like the below. You should not change the function name because that will require you to edit the function's name in osascript init.py, where it is being called.

def tempfile():
    f, path = tempfilelib.mkstemp()
    os.close(f)
    return path

Another thing you could do is update your osascript to see if this bug has already been fixed. Please let me know if you make any progress!

What happens if you run the script from the command prompt while Spotify is running?

python3 kashi.py in the folder where the script is located.

Could you please provide the output when you do that?

I'm interested to know if that's an error from BTT or from the script itself.

Imprint | Privacy Policy