IOError: [Errno 13] Permission denied: u'/dev/input/mice'

282 views
Skip to first unread message

Tom Potts

unread,
Jul 31, 2015, 8:04:26 AM7/31/15
to pi3d
I'm getting this on almost all input devices. It doesnt happen using tkinter so perhaps there's a lesson to be learned there?
I know I can just sudo but thats really not safe!

Paddy

unread,
Jul 31, 2015, 8:23:27 AM7/31/15
to pi3d, madto...@googlemail.com
Tom, recent discussion with Stuart Axo about same issue and I suggested making the pygame system (as used for windows setups) a general linux option. He did some initial mods which I will tidy and put in the next release of pi3d (possibly in a few weeks)
see
https://github.com/tipam/pi3d/issues/181
https://github.com/tipam/pi3d/issues/182
https://github.com/stuaxo/pi3d/commit/9e379dd09f2db4fd644b930fb933171653311221

Tom

unread,
Aug 3, 2015, 3:32:40 AM8/3/15
to Paddy, pi3d
I have noticed that each app claims the mouse/keyboard etc completely.
Wonder if you are asking for more power than necessary?
Tom

Paddy

unread,
Aug 4, 2015, 4:54:22 AM8/4/15
to pi3d, pat...@eldwick.org.uk
Tom, quite probably but I can't find any way in python to ask for less (or, rather, if I os.open the stream with the humblest of flags set it still needs root). On the Raspberry Pi python seems to be able to read from /dev/input/* as normal user but that probably involves some lowering of security at some level. There are other applications or python modules such as evdev, tk or pygame that get access but as pygame provided the apparatus that allowed me to eventually get pi3d working on windows there's already most of the required code included so that seems to be the simplest route. 

Piotr BEDNARSKI

unread,
Jan 6, 2016, 4:01:51 PM1/6/16
to pi3d, pat...@eldwick.org.uk
Hi guys, this has nothing to python or Paddy's code. This behavior is strictly related to user rights granted to user which runs python script. On Raspberry PI by default each user in in group called 'input'. Users in that group have rights to read and write to /dev/input/*. 
The simplest way to tackle that problem is to add the user account you use to run the script to proper group. On major number of linux distros this group is named 'input'.
Reply all
Reply to author
Forward
0 new messages