Hallo Zusammen ,
ich möchte ein Python script per CGI im Apache ausführen , welches auf den GPIO zugreift.
Problem ist das beim Aufruf des Scripts über Web dieser Fehler erscheint:
[font="Courier"]=> 19 GPIO.setup(BUTTON, GPIO.IN)
20 GPIO.setup(LED, GPIO.OUT)
21
GPIO = <module 'RPi.GPIO' from '/usr/lib/python2.7/dist-packages/RPi/GPIO.so'>, GPIO.setup = <built-in function setup>, BUTTON = 23, GPIO.IN = 1
<type 'exceptions.RuntimeError'>: No access to /dev/mem. Try running as root!
args = ('No access to /dev/mem. Try running as root!',)
message = 'No access to /dev/mem. Try running as root!' [/font]
Die Fehlermeldung spricht für sich und auch als Benutzer PI muss ich das Script per Sudo starten. (oder mich als root einloggen)
Eine Änderung von /etc/apache2/envvars
#export APACHE_RUN_USER=www-data
#export APACHE_RUN_GROUP=www-data
export APACHE_RUN_USER=root
export APACHE_RUN_GROUP=root
bewirkt nur , das apache nicht startet.
Da das ganze nicht vom Internet aus ansprechbar ist ,
stört es mich auch nicht wenn alles ROOT berechtigung hat !
Ein #!/usr/bin/env sudo python wird es wohl nicht sein
....... und nein ich möchte aus dem Script kein weiteres Script aufrufen.
Danke
Der Suchende