Navigation Menu+

Running a Python Script at Start Up

The first step in this would be to create a desktop file. A desktop file is something similar to that of a shortcut icon in windows, this file tells the computer the name of the application, its location, how to execute it, tags, description etc.

What we are going to do is create a bare bone desktop file. So lets fire up our favorite editor program, here we will be using nano. Open terminal and type

nano <Application Name>.desktop

In the text edit file

[Desktop Entry] Encoding=UTF-8
Type=Application
Name=<Application Name Goes here>
Icon=<Icon Path name>
Comment=
Exec=  <Code to be executed>
StartupNotify=false
Terminal=true
Hidden=false

Once you have replaced the ones in bold with your details. Save the file by pressing ctrl+x and then y

Once this is done, we need to paste this file in /home/pi/.config/autostart create the folder if not present. And reboot, this should now run the program automatically at startup

Submit a Comment

Your email address will not be published. Required fields are marked *