Why an error occurred when running gpio.py?
Description
Following the instructions on the RVspace Forum https://forum.rvspace.org/t/new-python-package-for-visionfive-gpio-thanks-to-zengjf/334, I input the command at the terminal
vim gpio.py
to create python program
gpio.py, and the following is the command:
sudo pip3 install gpio
sudo su
chmod 666 /sys/class/gpio/export
vim gpio.py #copy the following commands into gpio.py
import time
import gpio as GPIO
GPIO.setup(448, GPIO.OUT)
while True:
GPIO.output(448, GPIO.HIGH)
time.sleep(1.0)
GPIO.output(448, GPIO.LOW)
time.sleep(1.0)
However, an error occurred when I run the command on the Fedora system. Error
information:
AttributeError: partially initialized module 'gpio' has no attribute 'setup' (most likely due to a circular import)
SoC
JH7100
SBC
VisionFive
Cause
The name of the python file you created is the same as that of the GPIO library file imported.
Solution
Rename the gpio.py file to gpioctrl.py, and the command can run normally.