waveform80 / rpi-lgpio

A compatibility shim for lgpio emulating the RPi.GPIO API
https://rpi-lgpio.readthedocs.io/
Other
9 stars 5 forks source link

Strange Exception message #5

Closed ullix closed 4 months ago

ullix commented 6 months ago

Using rpi-lgpio on Raspi 5 as replacement for old RPi.GPIO 0.7.1. All works well when the program runs, but when I stop it I get this strange Exception message:

Exception ignored in: <function PWM.__del__ at 0x7fff9a608360>
Traceback (most recent call last):
  File "/home/ullix/.local/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 178, in __del__
  File "/home/ullix/.local/lib/python3.11/site-packages/RPi/GPIO/__init__.py", line 202, in stop
AttributeError: 'NoneType' object has no attribute 'error'

It happens after all GPIO functions are shut down and cleanup() had been called. It seems it prints out only after the program has exited.

The line 202 in the stop function is the 'except' line:

        try:
            lgpio.tx_pwm(_chip, self._gpio, 0, 0)
        except lgpio.error:
            pass
        lgpio.gpio_write(_chip, self._gpio, 0)
        self._running = False      
waveform80 commented 4 months ago

That's intriguing. Can I ask how you installed lgpio? My guess is via pip, in which case back in February you would've unfortunately obtained a very out of date version. A fresh pip install (or upgrade) of lgpio should remedy this now that I've added some up-to-date manylinux wheels on PyPI for lgpio

ullix commented 4 months ago

Of course, I installed via pip. I haven't see this recently, so maybe (?) I had reinstalled and the problem was gone? Don't remember.

waveform80 commented 4 months ago

Okay, I'll close this for now on the assumption that an old version of lgpio was involved. Please feel free to re-open if you see it again.