Issues Setting Up Python Script (Rookie Mistake)

Hello All,

Any issues why I'm getting the errors? I have installed Python 3. Not too sure!

Thanks in advance!

Step 1: Check out the error message.
It says there's a Syntax Error on the print function. That means your script is running on Python 2, not Python 3.

Step 2: Look at the "Launch Path"
The "Launch Path" tells BTT which version of Python is used to execute your script (i.e. the interpreter). "/usr/bin/python" is the path to the version Python that comes preinstalled on all Macs... which is Python 2.

Step 3: Change the "Launch Path"
Try changing the "Launch Path" to "/usr/bin/python3".

1 Like

Hey I tried that and it just crashes BTT, any ideas?

Interesting. I just tried setting the Launch Path to "/usr/bin/python3" and BTT crashed when I ran the script.

1 Like

Try this:

1 Like

Hey that seems to have worked!! Is there a way to make "hello world" print when you press the icon on the TB? so if the button says "HW" once pressed shows "hello world" ?


Step 1:
Create a "Widget/Gesture".

Step 2:
Select the "Run Shell Script and Show Return Value" widget.

Step 3:
Input this... and then click "Save".

Step 4:
Under "Predefined Action", select "Execute Shell Script/Task".

Step 5:
Input this... and then click "Save".

1 Like

Wow, fast reply. Thanks so much!!!! Have a great weekend!!!


1 Like

My pleasure. Don't hesitate to ask more questions if you have any. I'll see if I can help.

Moved to #discussion thread, no presets found in this post :wink:

@fortred2, Can you please help me with a similar issue? I'm at my wit's end.

I used to (last winter) be able to run a Python script that looked up the current player's lyrics and printed them to the Touch Bar.

But recently, the same exact script simply errors out with

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

Checking /Library/Frameworks/Python.Framework/Versions/3.7/lib/python3.7/site-packages, the module, and all other required modules are indeed there. Same with those modules in Python 2.7's folder.

Strangely enough, when I run my Python script in the Terminal, there is no problem...BTT doesn't seem to be able to find my py modules.

Any ideas would be very much appreciated. Screenshot of the settings below.

Please let me know if you would like the full py script to test.