vsergeev / python-periphery

A pure Python 2/3 library for peripheral I/O (GPIO, LED, PWM, SPI, I2C, MMIO, Serial) in Linux.
MIT License
519 stars 139 forks source link

ImportError when trying to import LED from periphery module #69

Open goodniuniu opened 4 months ago

goodniuniu commented 4 months ago

Body:

Hello,

I've encountered an import error while trying to use the periphery library for controlling LEDs in a Python script. Below is the error message I received:

Traceback (most recent call last):
  File "/home/pico/github/epaper-with-raspberrypi/tmp/luckfox_led.py", line 1, in <module>
    from periphery import LED
ImportError: cannot import name 'LED' from 'periphery' (/home/pico/github/epaper-with-raspberrypi/venv/lib/python3.10/site-packages/periphery/__init__.py)

Steps to Reproduce:

  1. Create a Python script named luckfox_led.py with the following content:
    from periphery import LED
    # Additional code to manipulate LEDs
  2. Run the script using Python 3.10 in a virtual environment: python luckfox_led.py.

Expected Behavior:

The script should import the LED class from the periphery module without any issues, allowing further LED manipulation commands to be executed.

Actual Behavior:

An ImportError is raised, indicating that the LED class cannot be imported from the periphery module.

Environment:

Any insights or solutions to resolve this import issue would be greatly appreciated. Thank you!