Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 6970

Python • Autostart Python script in pyenv help needed

$
0
0
Hi Guys,

I'm very new at Rasberry with a little bit of arduino under my belt but not much.

I'm trying to setup a Karaoke for my kids using a Pi 5.
I've install an awesome program ( have a look if you are interrested, it is reaaly brilliant https://github.com/xuancong84/OpenHomeKaraoke). I had to set it up in pyenv to use python 3.9.5 but it works. I also created a desktop shortcut that calls up a Start.sh script (that set the pyenv and launch the python app)

might not be the right way to do it, probably over complicated, but hey... it works...

Now, because I am using this Pi 5 just for the karaoke and users use their phones to pick songs and everything else, I don't actually need mouse and keyboard to use the program. So, I'm trying to have the karaoke start at boot, and I am failling miserably...

Now, this is the Start.sh script that set the pyenv and launch the python app:

Code:

#!/bin/bashsource ~/.bashrc# Source pyenv init to enable shims and other features export PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH" export PYENV_VERSION="3.9.5"# Launch app    python3 /home/myuser/OpenHomeKaraoke/app.py -d /mnt/Karaoke -V -nv -hq        exec bash# Reset version unset PYENV_VERSION


and this is the desktop shortcut I created (that calls up the "start.sh" manually:

Code:

[Desktop Entry]Name=Start KaraokeComment=Open Karaoke in a terminalExec=/home/myuser/OpenHomeKaraoke/Start.shTerminal=trueType=ApplicationIcon=/home/myuser/OpenHomeKaraoke/logo.pngX-KeepTerminal=truePath=/home/myuser/OpenHomeKaraoke
And finally these are somne of the things I tried:

I tried this Start.sh in /home/myuser/.config/autostart/

Code:

@lxpanel --profile LXDE-pi@pcmanfm --desktop --profile LXDE-pi@xscreensaver -no-splash@lxterminal -e bash /home/myuser/OpenHomeKaraoke/Start.sh
Did nothing as non executable and gave me a black screen as executable

I tried this start.desktop in /home/myuser/.config/autostart/

Code:

[Desktop Entry]Exec=/bin/bash -c "source ~/.bashrc; export PATH="$HOME/.pyenv/shims:$HOME/.pyenv/bin:$PATH";  export PYENV_VERSION="3.9.5"; python3 /home/myuser/OpenHomeKaraoke/app.py -d /mnt/Karaoke -V -nv -hq; python3 /home/myuser/OpenHomeKaraoke/app.py -d /mnt/Karaoke -V -nv -hqHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=trueName=startComment=Runs my Python script with pyenvPath=/home/myuser/OpenHomeKaraoke
Did nothing

I tried this karaoke.desktop in /home/myuser/.config/autostart/

Code:

[Desktop Entry]Name=karaokeComment=Open Karaoke in a terminalExec=/home/myuser/OpenHomeKaraoke/Start.shHidden=falseNoDisplay=falseX-GNOME-Autostart-enabled=true
Did nothing

I tried to set them up as executable as well as non executable... the best I got was a black screen using Start.sh as executable.

I also tried small variations of all of them which I didn't record but none of them worked :(

What am I doing wrong?

Thanks for your help.
bebetaz

Statistics: Posted by bebetaz — Sun Aug 17, 2025 6:17 am — Replies 2 — Views 124



Viewing all articles
Browse latest Browse all 6970

Trending Articles