hifiberry / hifiberry-os

Linux distribution optimized for audio playback
MIT License
958 stars 123 forks source link

HBOS 64 Alpha 8: Python "No module named 'RPi'" #555

Closed kontaktwackler closed 1 month ago

kontaktwackler commented 1 month ago

Describe the bug I am trying to reuse a python script used to control volume via a rotary encoder. Script was working fine on latest non 64bit hifiberry os version. on 64 alpha 8 the script is not working because this python import command in the script fails: from RPi import GPIO

HiFiBerryOS version 20240523

HiFiBerry sound card DAC+/Amp2

To Reproduce python3: try to import "from RPi import GPIO"

Expected behavior module RPi should be available to be able to control GPIO

hifiberry commented 1 month ago

You're right. However as the GPIO module uses an old kernel interface that's not available anymore, we can't add this. The code needs to be rewritten.

hifiberry commented 1 month ago

I just noticed that you're using your own script. In this case, you have to rewrite it. Rpi.GPIO isn't supported anymore on the latest Linux kernel.

kontaktwackler commented 1 month ago

Thanks for the quick reply. Will check how to rewrite for new kernel.

hifiberry commented 1 month ago

Have a look at the gpiod module, e.g. here: https://github.com/hifiberry/audiocontrol2/blob/master/ac2/plugins/control/powercontroller.py