Permissions Issues

I downloaded the provided code and I can run it without issue…as root. For some reason when I try to run as the user which I installed the software as, I get a big stack of permission issues.
File “./BerryAutoPotter.py”, line 15, in
automationhat.relay.one.off()
File “/usr/lib/python2.7/dist-packages/automationhat/init.py”, line 234, in off
self.write(0)
File “/usr/lib/python2.7/dist-packages/automationhat/init.py”, line 273, in write
self.setup()
File “/usr/lib/python2.7/dist-packages/automationhat/init.py”, line 259, in setup
setup()
File “/usr/lib/python2.7/dist-packages/automationhat/init.py”, line 354, in setup
_ads1015 = ads1015(smbus.SMBus(1))
IOError: [Errno 13] Permission denied

I did a little digging with trying to open up permissions on the files inside the automationhat folder, but to no avail. Are there some external root level dependencies your code expects? Do I need to be able to sudo without password or something?

The code expects your user to have access to /dev/i2c-1 which has been standard on Raspbian for years. You can configure accordingly with udev/groups or add your user to the i2c group if one exists on your distribution.

Okay, I’ll extend the code to execute a system call and check that permission, offering up a more explicit error message in the event that device is not accessible to the current user, like you are currently doing with permission on the /dev/input/event* files. Thanks.