Thursday, February 3, 2022

[SOLVED] How to automatically launch python file once GUI has loaded on Raspbian Pixel

Issue

I now this has been asked before, but I have spent hours and hours trying to find out how to do this and absolutely nothing has worked. I have a python file that I want to automatically run in a terminal window after the pi has booted and loaded its GUI.

I don't know what else to do, and the annoying thing is I had it working for the same project (it took a long time to find out how then as well), but the pi crashed today and I can't remember how to do it again. All I can remember is that I added something to a file ending in /autostart, if that helps.


Solution

I was able to launch a python file on startup by running sudo nano /home/pi/.config/lxsession/LXDE-pi/autostart and adding @lxterminal -e python /home/pi/weatherStation/core.py at the end of the file



Answered By - HenryHunt
Answer Checked By - Pedro (WPSolving Volunteer)