Andy Posted June 12, 2018 Share Posted June 12, 2018 After reading several threads without success I need to ask again how I can get permission as a "normal" user to use the GPIO pins via my python script: #!/usr/bin/python import time PIN_NUM = 200 print "GPIO %s" % PIN_NUM try: # check to see if the pin is already exported open(''.join(['/sys/class/gpio/gpio',str(PIN_NUM),'/direction'])).read() except: # it isn't, so export it open('/sys/class/gpio/export', 'w').write(str(PIN_NUM)) # set gpiochip198 to output open(''.join(['/sys/class/gpio/gpio',str(PIN_NUM),'/direction']), 'w').write('out') for i in range(1000): open(''.join(['/sys/class/gpio/gpio',str(PIN_NUM),'/value']), 'w').write("1") time.sleep(0.5) open(''.join(['/sys/class/gpio/gpio',str(PIN_NUM),'/value']), 'w').write("0") time.sleep(0.5) # remove GPIO87 folder from file system open('/sys/class/gpio/unexport', 'w').write(str(PIN_NUM)) I get this error: Traceback (most recent call last): File "testGPIO.py", line 17, in <module> open(''.join(['/sys/class/gpio/gpio',str(PIN_NUM),'/direction']), 'w').write('out') IOError: [Errno 13] Permission denied: '/sys/class/gpio/gpio200/direction' So I tried to add: SUBSYSTEM=="gpio", ACTION=="add", RUN="/bin/sh -c '\ chown -R root:gpio /sys/class/gpio && chmod -R 770 /sys/class/gpio;\ chown -R root:gpio /sys$DEVPATH && chmod -R 770 /sys$DEVPATH\ '" into /etc/udev/rules.d/90-gpiomem.rules and yes my username is the GPIO group.... Can someone help me further...thx Andy Link to comment Share on other sites More sharing options...
rusatch Posted June 12, 2018 Share Posted June 12, 2018 Check permissions on /sys/class/gpio May be it will help you Link to comment Share on other sites More sharing options...
Andy Posted June 12, 2018 Author Share Posted June 12, 2018 thx for the link but still I get the same error.... Andy Link to comment Share on other sites More sharing options...
Recommended Posts