Ubuntu – Run python script IN TERMINAL after Lubuntu login

lubuntupythonstartup

I've spent the night trying to figure out how to run a python script in a terminal at startup.

Adding it to init.d will run the script, but I don't see a terminal window or any other indication the script is running other than the audio output the python script produces. I would like to be able to see and interact with this script in a terminal just as if I'd ran it from a terminal.

My next successful step was to make a .desktop file in ~/.config/autostart. My Exec is

Exec=lxterminal -e "python ~/scripts/myscript.py"

When I log in, I see a terminal window flash for just a brief moment – but then disappear. No sound is produced from the python script so I assume it quit running. How do I start a terminal window at system startup and run a Python script in it?

Best Answer

It seems your script is running, but you want the term to stay open. If that's the goal:

Exec=lxterminal -e "python ~/scripts/myscript.py && /bin/bash"  

Should keep the term open for you...

Related Question