0

I have a python script with a GUI that was designed with qt5, the script runs fine whenever I run it through the terminal or Thonny IDE. But no matter how much I tried, after trying many guides, videos, Chatgpt sessions I couldn't make it run on boot or AutoStart after boot to the Raspbian..

After I gave up I built a distributable file using pyinstaller --onefile your_script.py and tried the same but with no success!.

Now at the end I am satisfied of having my application running by double clicking it's icon from the desktop which is as well not working as:

  • the exe file should be in the same folder of the python scripts and other files.
  • every time I double click it, it asks "Execute, execute in terminal, cancel".

Is there a way to just create a desktop shortcut to run the application directly?

1 Answer 1

0

A search for Raspberry Pi desktop autostart app had https://forums.raspberrypi.com/viewtopic.php?t=294014 as the first hit. It describes 4 ways to do what you want, depending on your OS and other factors.

One method requires using the command line. Assuming you are user pi:

mkdir -p /home/pi/.config/lxsession/LXDE-pi
cp /etc/xdg/lxsession/LXDE-pi/autostart /home/pi/.config/lxsession/LXDE-pi/

Edit the file /home/pi/.config/lxsession/LXDE-pi/autostart and add a new line at the bottom, naming your process. The reference show this example, to start a Python 3 script:

@lxpanel --profile LXDE-pi
@pcmanfm --desktop --profile LXDE-pi
@xscreensaver -no-splash
@lxterminal -e python3 /path/my_script.py

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.