Run video at the press of a button

I’m trying the RPi solution from this site Push a Button and Play a Video
but when trying to run the script I get this errorlog

2020-03-02 18:04:43.068 T:1794110176 WARNING: CPythonInvoker(5): Script invoked without an addon. Adding all addon modules installed to python path as fallback. This behaviour will be removed in future version.
2020-03-02 18:04:44.193 T:1794110176 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<–
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type ‘exceptions.RuntimeError’>
Error Contents: No access to /dev/mem. Try running as root!
Traceback (most recent call last):
File “/home/osmc/Movies/HopnPop.py”, line 23, in
GPIO.setup(18,GPIO.OUT)
RuntimeError: No access to /dev/mem. Try running as root!
–>End of Python script error report<–

Anyone got an idea how to fix it?

I’d be asking the author of your tutorial.

I think an udev rule needs to be updated, possibly because of the 4.19 kernel – though that’s just a guess.

Using sudo, edit file /etc/udev/rules.d/996-fix-gpiomem.rules and add this line:

SUBSYSTEM=="bcm2835-gpiomem", GROUP="osmc", MODE="0660"

then reboot. See if that helps.

Do we need to update the udev rules?

Probably. Something has changed, so that we’re back to the old permissions on /dev/gpiomem:

crw------- 1 root root 242, 0 Mar 6 11:32 /dev/gpiomem

With the new line:

crw-rw---- 1 root osmc 243, 0 Mar 2 19:45 /dev/gpiomem

OK, I’ll check that out.