PetitPrinc3 / PIpod-Nano

A DIY Ipod nano lookalike involving a raspberry pi zero
17 stars 1 forks source link

Buttons do not work #1

Closed ingelumer closed 4 years ago

ingelumer commented 4 years ago

Hello, first many thanks for the great idea and script, really love the additions to PirateAudio!

I have installed the software just as described with the script on a fresh system, but the buttons on the display do not work, neither in normal mode (play/stop, next, Vol..) nor the shutdown.

Playing aroung I found out the the Python script to control the addition Shutdown / Vol feature is not running giving below error: python /usr/share/PIpodScripts/buttons.py Traceback (most recent call last): File "/usr/share/PIpodScripts/buttons.py", line 2, in from gpiozero import Button ImportError: No module named gpiozero

Control over Webclient is running fine, also showing correct information on display. I am running Buster lite.

Please any idea?

Thanks and regards Ingelumer

PetitPrinc3 commented 4 years ago

Hi !

So gpiozero is a python library. Because you are running the lite version of raspbian, it is not installed by default. To fix this, follow this link : https://gpiozero.readthedocs.io/en/stable/installing.html (You should be using python 2 on buster if I recall correctly) Hope everything is working normal now, let me now !

Gavroche

ingelumer commented 4 years ago

Hello Gavroche, many thanks for your quick reply, that did the trick 👍

I have installed the gpiozero package with sudo & python3:

sudo pip3 install gpiozero

and updated the /etc/rc.local:

sudo python3 /usr/share/PIpodScripts/buttons.py

After rebooting all Buttons are working just like they should :-)

Ingelumer

TerryJColes commented 4 years ago

(You should be using python 2 on buster if I recall correctly)

I appreciate that this Issue is closed, but I'd like to point out that The Raspberry PI OS (as it is now called) seems to arrive with Python3 by default and (presumably because of this) various Python3 modules are installed during the installation of Mopidy and its dependencies. This means that the script 'Buttons.py' in '/usr/share/PIpodScripts' barfs because it is defined as '#!/usr/bin/env python' and not '#!/usr/bin/env python3'.

I had to uninstall Python3 and install Python (2.7) to get the right version of gpiozero.

Having said all that, thanks for your good work. Once I'd sorted this out, everything worked out of the box!

An excellent development.

PetitPrinc3 commented 4 years ago

Hi !

Thank you for pointing this issue out. Back when I created this project, I was using raspbian buster, and a lot of things used python 2, so it was the easy path for me ! Unfortunately, I didn't have time to update the project, hence this kind of issue.

Glad it finally worked for you !