Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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!

share|improve this question

2 Answers 2

up vote 3 down vote accepted

This one should work:

gnome-terminal -e "python3 /path/to/script.py"
share|improve this answer
    
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).

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.