I’m using my pi as a tiny personal web server, and writing everything in python. I’m not using any frameworks, so apache is running the scripts through cgi. I thought it would be neat to have the scripts do some stuff with the Blinkt I’ve got that until now has been sitting there doing nothing (for example, I’d like a light to come on at the start of a script then turn off at the end of the script, to give me a visual indicator that a script is being executed).
Blinkt works perfectly if I run scripts that use it as a user, but (for security reasons) apache runs python scripts as a weird “not a real user” user, and when that happens the Blinkt library doesn’t work.
The error message it spits out is
<type 'exceptions.RuntimeError'>: No access to /dev/mem. Try running as root!
and originates here
/usr/lib/python2.7/dist-packages/blinkt.py in show() 65 GPIO.setmode(GPIO.BCM) 66 GPIO.setwarnings(False) => 67 GPIO.setup([DAT,CLK],GPIO.OUT) 68 _gpio_setup = True
Is there anything I can do to make this work? (Besides some kind of horrible hack that makes apache run scripts as root - which ain’t gonna happen on my watch!).