# Open terminal window and execute Python script on startup

I have a Python script which I would like to execute at every startup. I can run it by adding this to the startup applications:

python3 /path/to/script.py


That works, but it doesn't open a terminal window, so I can't see the program's output. How could I make it open a terminal window and execute the script in there?

Note: I get the window to stay open with input(' ') at the end of the Python script. Thanks!

-

This one should work:

gnome-terminal -e "python3 /path/to/script.py"

-
Thank you very much! This works perfectly. Just out of interest - do you have any idea how you would do something similar on Windows7? –  Sean Sep 29 '13 at 18:17
Try start cmd /k python3 X:\path\to\script.py –  the_Seppi Sep 29 '13 at 20:07

To run an application in a system's default terminal we may define a .desktop file we can then add to our startup applications in ~/.config/autostart with the following content:

[Desktop Entry]
Encoding=UTF-8
Name=Name of Application
Exec=python3 path/to/application.py
Terminal=true
Type=Application
StartupNotify=true
NoDisplay=true


Note that the terminal will close on termination of our script only if our terminal profile is set to do so (default in gnome-terminal but editable from profile settings).

-