I have installed a lib via pip
: sudo pip install adafruit-ws2801
Then, I gave it rights: sudo chmod +x /etc/openhab2/scripts/myscript.py
However, when I try to start it as another user, an error appears:
sudo su -s /bin/bash -c '/etc/openhab2/scripts/myscript.py' openhab
This error:
...
File "/usr/local/lib/python3.4/dist-packages/Adafruit_GPIO/SPI.py", line 42, in __init__
self._device.open(port, device)
PermissionError: [Errno 13] Permission denied
When I start the script as my current user (without sudo), everything is fine. But this user can not access it. Do I need to give more permissions for this user? In the first line of the python file, I wrote #!/usr/bin/env python3
Found out that the user is not in the right group. So I added it in the specific group (spi) and now it works!