Posts: 20
Joined: Fri Apr 12, 2013 5:50 pm

Permission Error Calling Sense Hat

Thu Feb 02, 2017 6:55 pm

Using Raspbian and I created my 1st python script today and got the following error trying to call the Sense Hat on my RPi3:

Code: Select all

18:50:22-user1@rpi1:~/dashboard $ python
Traceback (most recent call last):
  File "", line 3, in <module>
    sense = SenseHat()
  File "/usr/lib/python2.7/dist-packages/sense_hat/", line 92, in __init__
    self._stick = SenseStick()
  File "/usr/lib/python2.7/dist-packages/sense_hat/", line 57, in __init__
    self._stick_file =, 'rb', buffering=0)
IOError: [Errno 13] Permission denied: '/dev/input/event0'
The script is in my user1 ~/ :

Code: Select all

18:53:43-user1@rpi1:~/dashboard $ pwd; ls -la
total 12
drwxr-xr-x 2 user1 users 4096 Feb  2 18:50 .
drwx------ 5 user1 users 4096 Feb  2 18:50 ..
-rwxrwxr-x 1 user1 users  231 Feb  2 18:50

User avatar
Posts: 3519
Joined: Wed Nov 23, 2011 1:10 am
Location: Sheffield, England

Re: Permission Error Calling Sense Hat

Thu Feb 02, 2017 10:51 pm

What group does /dev/input/event0 belong to (usually it's in the input group)?

Code: Select all

pi@rpi3:~ $ ls -l /dev/input/event0
crw-rw---- 1 root input 13, 64 Jan 16 21:54 /dev/input/event0
And is your user1 a member of the group that /dev/input/event0 is in?

Code: Select all

pi@rpi3:~ $ groups pi
pi : pi adm dialout cdrom sudo audio video plugdev games users input netdev spi i2c gpio
Here you see /dev/input/event0 is in the input group, and so is my user pi.

If /dev/input/event0 is in the input group and user1 isn't you can add user1 to the input group with

Code: Select all

sudo addgroup user1 input
She who travels light — forgot something.
Please note that my name doesn't start with the @ character so can people please stop writing it as if it does!

Return to “Python”