problem installing "Pi tools" addon

  • Hello,

    I'm trying to install a Shutdown buttons to my Raspberry pi 3B, I followed a few forums and here is what I did;

    1. mkdir /storage/.Scripts

    2. nano /storage/.scripts/shutdown_pi.py

    In "/storage/.scripts/shutdown_pi.py" I have the following instructions;

    3. nano /storage/.config/autostart.sh

    in "/storage/.config/autostart.sh" I have the following instructions:

    Code
    (
    python /storage/.Scripts/shutdown_pi.py
    ) &

    3. I went in the libreELEC UI and did the following;

    Program ---> Get more ... ---> Raspberry Pi Tools ---> install

    4. reboot

    when I tested the buttons nothing happened so I tried;

    LibreELEC:~/.Scripts # python shutdown_pi.py

    here is what I got:

    Traceback (most recent call last):
    File "shutdown_pi.py", line 5, in <module>
    import RPi.GPIO as GPIO
    ImportError: No module named RPi.GPIO

    Is there a step I forgot?, or is there another thing I need to install?

    Thanks for your help.

  • you'll need to add the path

    at the top of your script you will need something like

    Code
    import sys
    sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')

    or something similar, I can't remember the exact path


  • you'll need to add the path

    at the top of your script you will need something like

    Code
    import sys
    sys.path.append('/storage/.kodi/addons/virtual.rpi-tools/lib')

    or something similar, I can't remember the exact path

    Thank you,

    I no longer have " ImportError: No module named RPi.GPIO".. and when I do, " LibreELEC:~/.Scripts # python shutdown_pi.py" it stops and waits, which is what it is supposed to do.

    but when I press the button nothing happens... I even tried after reboot...

    Tomorrow I'ill have a look and see if the wires are connected correctly (I mean it's kind of late right now, where i' am at),
    I believe all the wires are connected correctly, but just to make sure I'll have a look (but tomorrow not now :P ).

    Anyway now I think I have a problem with the autostart.sh file... I must admit that I didn't fully understand the instruction, and I'm pretty sure that I messed it up somehow... so a little help on that front would be nice. (tuto I used is: Autostart.sh - OpenELEC )

    I know the code in " shutdown_pi.py " works since I used it on a Rpi 2B with a Raspbian OS, the only difference is the autostart.sh part...

    ps: You are right for the path (it is not similar, IT IS: ('/storage/.kodi/addons/virtual.rpi-tools/lib'), thought you should know you remembered right :D .


  • Only thing I can see wrong is that you change the use of "scripts" and "Scripts". So watch your capitalization and keep it consistent (lowercase is preferred).

    Thank you Irusak,

    So I changed ".Scripts" to ".scripts", that did the trick.. works great!!!
    (all-thought I do not understand why the "UpperCase" did not work, as long as I have UpperCase ".S" everywhere it should have been ok)

    Anyway thanks again for your help!!!