adafruit / Adafruit_Blinka

Add CircuitPython hardware API and libraries to MicroPython & CPython devices
https://learn.adafruit.com/circuitpython-on-raspberrypi-linux
MIT License
438 stars 328 forks source link

Bug in pwmio.py introduced with commit e13c0662ce0da9e936c652953aa1d3f9d6b872d5 #808

Closed richterf closed 2 months ago

richterf commented 2 months ago

Board Name

Raspberry Pi 4

Steps

  1. Install current Adafruit_Blinka via pip3
  2. Start python shell and try to import pwmio
  3. Get error:
    >>> import pwmio
    Traceback (most recent call last):
    File "<stdin>", line 1, in <module>
    File "/home/pi/lf7/.venv/lib/python3.11/site-packages/pwmio.py", line 62, in <module>
    raise NotImplementedError("pwmio not supported for this board.")
    NotImplementedError: pwmio not supported for this board.

Description

No response

Additional information

Line 45 in src/pwmio.py should probably be elif instead of if. In its current form importing pwmio raises an error even if any detection above that line returns True. https://github.com/adafruit/Adafruit_Blinka/blob/e13c0662ce0da9e936c652953aa1d3f9d6b872d5/src/pwmio.py#L45-L46

makermelissa commented 2 months ago

Good catch. Just submitted a fix.