Search code examples
pythonubuntustartupboot

Xubuntu start python script at boot - nothing works


I'm trying to run a python script at startup, I tried to add a [Dekstop Entry] file (.desktop) in /etc/autostart but I see the terminal for a flash and then it closes.

I tried to add the python script with "Session and Startup"

I tried the systemctl way but I got every type of errors...

There is someone out there that managed to autostart a pyhton script in Xubuntu?


Solution

  • I solved by doing like so:

    1. Create the folder /home/username/.config/autostart

    2. Right Click on desktop and select "Create Launcher"

    3. Fill the fields, in "Execute" put the command (ex. pyhton3 path/to/file.py), in "Working Directory" put the folder where the file.py is stored (ex. path/to), check "run in terminal"

    4. drag and drop the file you created in the autostart folder created in the beginning