I’m running openhab 2 on a raspberry pi 3+ series and getting a permission denied error in my .rules file when I call the adafruit library for ws2801 and gpio.
I accidentally installed the adafruit package under a local user account so the openhab user can not access it causing the error.
Use chmod and chgrp to add group permissions for the openhab user.that is the simplest answer.
Google the two commands there is plenty of help. You will need something like chmod 755 somefiles this will give rwx permissions for owner and read execute for group.
You may need to change the group with chgrp though. Without more info in your file structure hard to give precise commands.
It may not hurt to install the library in a common area, if it is not already in a common area.
@OpenHabitat - Hello (I assume this is a continuation of the discussion we had in the comments of my video?
@Thedannymullen - I don’t have experience using external libraries with OH on RPI, but shouldn’t they be placed in the openhab-sys/runtime/lib folder? Wouldn’t that place it in a folder that already has permissions for the openhab user (would still likely require a chmod to the .lib file itself for openhab to access), i.e.:
@OpenHabitat try what bk said. Also if you did chmod +x directory this usually only does the top level you may need the recursive flag possibly to get the files underneath.
So the permission error has gone, and now I get this:
File "/etc/openhab2/scripts/ws2801color.py", line 8, in <module>
import Adafruit_WS2801
File "/usr/local/lib/python3.5/dist-packages/Adafruit_WS2801/__init__.py", line 1, in <module>
from .WS2801 import *
File "/usr/local/lib/python3.5/dist-packages/Adafruit_WS2801/WS2801.py", line 24, in <module>
import Adafruit_GPIO.SPI as SPI
File "/usr/local/lib/python3.5/dist-packages/Adafruit_GPIO/__init__.py", line 3, in <module>
from Adafruit_GPIO.GPIO import *
ImportError: No module named 'Adafruit_GPIO.GPIO'
Seems there is something missing from the library?
Final ditch effort
I copied my script to so it has local access to adafruit library:
/usr/local/openhab_scripts/fireplace
But I get this crazy import error again…
File "/usr/local/openhab_scripts/fireplace/ws2801color.py", line 8, in <module>
import Adafruit_WS2801
File "/usr/local/lib/python3.5/dist-packages/Adafruit_WS2801/__init__.py", line 1, in <module>
from .WS2801 import *
File "/usr/local/lib/python3.5/dist-packages/Adafruit_WS2801/WS2801.py", line 24, in <module>
import Adafruit_GPIO.SPI as SPI
File "/usr/local/lib/python3.5/dist-packages/Adafruit_GPIO/__init__.py", line 3, in <module>
from Adafruit_GPIO.GPIO import *
ImportError: No module named 'Adafruit_GPIO.GPIO'