[Tutor] how to see a terminal window showing progress of os.system

Alan Gauld alan.gauld at btinternet.com
Fri Dec 18 02:02:03 CET 2009


"pedro" <pedrooconnell at gmail.com> wrote

> Hi I am sending commands to the command line using python's os.system.
> 
> Is there a way to see a terminal window showing the progress of 
> os.system as if you had just run the command from a normal terminal 
> window? As it is now it runs completely in the background

You can sometimes launch a terminal with your program running in it but 
thats usually not the best way to do it. Normally you would use the 
subprocess module and the Popen class to capture the output of the 
command and either monitor it for some event or display it within your 
own program. That looks more professional and gives you much more 
control

You will find examples of using subprocess in the Using the OS topic 
of my tutorial.

HTH,


-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/



More information about the Tutor mailing list