Description
Shell Scripts are not able to find Python modules anymore. Previously (in Jan/Feb), this exact same Python script worked fine without errors, but since around March it stopped working, returning "ModuleNotFoundError".
I checked, and confirmed that all needed modules are properly located in:
"/Library/Frameworks/Python.Framework/Versions/3.7/lib/Python3.7/site-packages"
Also, the same script works totally fine when I fire it in Terminal, so BTT's behavior seems strange.
Screenshots
Device Information:
- Type of Mac: MacBook Pro (15-inch, 2018)
- macOS version: macOS Mojave 10.14.5
- BetterTouchTool version: 3.080 (1187)
Any help would be much appreciated!
Did you recently install a new python version?
There hasn't been a change to the BTT shell script runner.
However the general problem is that the PYTHONPATH environment variable is not available in the BTT shell script environment (as it's only set for your shell). Usually Python also checks the standard module locations if it doesn't have the PYTHONPATH, but maybe something changed in a recent version or there is a bug in 3.7
I plan to add a way to set environment variables soon.
1 Like
Thanks for the reply. I may have updated my Python 3 installation, but I can't remember exactly.
The ability to set env variables would be massively helpful. Thank you!
I have added this in the latest alpha today.
Thank you!
I tried specifying the PATH variable for python3, but seem to be getting the same error. Am I missing something obvious? I also tried $PATH and both with/without parentheses around the folder.
Have you tried
PYTHONPATH=/Library/Frameworks/Python.Framework/Versions/3.7/lib/Python3.7/site-packages
?
1 Like
Thank you Andreas. That worked.
FYI, "return(lyrics)" did not work to show output onto the widget for some reason, but "print(lyrics)" did.
Thanks again for helping me with this. I'll update my code and instructions for installation based on your guidance.