Thank you for your response and I appreciate the problems of running C programs under root, but it does not change the fact that I cannot run the python script from the CLI using root. The error I noted already is:
- Code: Select all | TOGGLE FULL SIZE
AttributeError: module 'adafruit_platformdetect.board' has no attribute 'NODEMCU'
Do you know what causes this error?
I did try, as you suggested, using sudo -u and got the following (the same error):
- Code: Select all | TOGGLE FULL SIZE
root@na:/home/daco# sudo -u daco python3 lfploadoff.py
Traceback (most recent call last):
File "lfploadoff.py", line 2, in <module>
import board
File "/home/daco/src/src/adafruit-blinka/src/board.py", line 41, in <module>
if board_id == ap_board.NODEMCU:
AttributeError: module 'adafruit_platformdetect.board' has no attribute 'NODEMCU'
How can this AttributeError be fixed?
Using the user daco from the CLI gives the following:
- Code: Select all | TOGGLE FULL SIZE
daco@na:~$ python3 lfploadoff.py
Traceback (most recent call last):
File "lfploadoff.py", line 2, in <module>
import board
File "/home/daco/src/src/adafruit-blinka/src/board.py", line 93, in <module>
from adafruit_blinka.board.odroidn2 import *
File "/home/daco/src/src/adafruit-blinka/src/adafruit_blinka/board/odroidn2.py", line 3, in <module>
from adafruit_blinka.microcontroller.amlogic.s922x import pin
File "/home/daco/src/src/adafruit-blinka/src/adafruit_blinka/microcontroller/amlogic/s922x/pin.py", line 3, in <module>
GPIO496 = Pin((0, 0))
File "/home/daco/src/src/adafruit-blinka/src/adafruit_blinka/microcontroller/generic_linux/libgpiod_pin.py", line 25, in __init__
self._chip = gpiod.Chip(str(pin_id[0]), gpiod.Chip.OPEN_BY_NUMBER)
PermissionError: [Errno 13] Permission denied
If I use sudo on the above command everything works just fine.
The permission error above seems to be in the module gpiod but I do not know where it is located to see its permissions. I tried:
- Code: Select all | TOGGLE FULL SIZE
sudo find / -name gpiod
but it yielded nothing. It seems that if gpiod permissions could be changed then the user daco could be used to run the script without sudo.