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 want to create an Ubuntu Application which has a GUI for a CLI-application. I want to run a terminal command, for example, on a button click in my application. How can I do this? Or should I really not being doing this?

Can I also grab what would be displayed as the last/current line when running the terminal command?

(I am writing my app using Quickly as described here)

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Python (the programming language the desktop Quickly template uses) provides the subprocessing module for calling other programs. The documentation is here: http://docs.python.org/library/subprocess.html

It provides convenience functions, but for the more advanced stuff (like reading the output as you described if I recall correctly) you often need to use its Popen class.

share|improve this answer
add comment

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.