If I run the script with a user account I get the following result:
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 do exactly the same command but put sudo in front of it the script works perfectly without errors and output works as expected on the GPIO expander board.
If, however, I run the same script with the root account I get the following result:
root@na:/home/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'
I do need to run the script as root so I need to find out why the AttributeError occurs and what changes need to be made to prevent the error.
Also I would like to know how to fix the PermissionError that occurs with the user account when not prefacing the command with sudo.
@paulcrawford GitHub issues are for reporting bugs or making feature requests. Please keep your support questions in the forums, particularly the thread you already started:
I am having errors when I run the following python script:
`import time import board import busio import digitalio
from adafruit_mcp230xx.mcp23017 import MCP23017 i2c = busio.I2C(board.SCL, board.SDA) mcp = MCP23017(i2c) pin2 = mcp.get_pin(2) pin2.switch_to_output(value=True) time.sleep(0.5) pin2.switch_to_output(value=False) `
If I run the script with a user account I get the following result:
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 do exactly the same command but put sudo in front of it the script works perfectly without errors and output works as expected on the GPIO expander board.
If, however, I run the same script with the root account I get the following result:
root@na:/home/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'
I do need to run the script as root so I need to find out why the AttributeError occurs and what changes need to be made to prevent the error.
Also I would like to know how to fix the PermissionError that occurs with the user account when not prefacing the command with sudo.