Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Solved: After upgrading to 9.3 my own Python scripts stopped working
#4
(04-04-2025, 08:50 PM)svitalya Wrote:
(04-04-2025, 08:44 PM)Tim Curtis Wrote: Please post the errors.

This script works fine with version 9.2 and earlier.

With version 9.3 I have this.

moode@moode:~ $ sudo python3 /home/moode/fan_ctrl.py
Traceback (most recent call last):
  File "/home/moode/fan_ctrl.py", line 9, in <module>
    GPIO.setup(17, GPIO.OUT)
  File "/usr/lib/python3/dist-packages/RPi/GPIO/__init__.py", line 704, in setup
    initial = _check(lgpio.gpio_read(_chip, gpio))
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/lgpio.py", line 903, in gpio_read
    return _u2i(_lgpio._gpio_read(handle&0xffff, gpio))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/lgpio.py", line 458, in _u2i
    raise error(error_text(v))
lgpio.error: 'GPIO not allocated'

Are the scripts already running in the background (after being started because of the added lines in rc..local)?

If so they own the gpio lines in question. They can't be allocated again by a script started from the command line.

To test this, I tried your scripts from the command line before I copied the two new lines into /etc/rc.local and they ran fine.

Then I added the lines in /etc/rc.local and rebooted.

'ps aux' showed the two scripts are running and now I get the same error you do if I try also to run the scripts from the command line.

Regards,
Kent
Reply


Messages In This Thread
RE: After upgrading to 9.3 my own Python scripts stopped working - by TheOldPresbyope - 04-05-2025, 01:56 AM

Forum Jump: