[Tutor] system call
Eric Walker
sli1que at yahoo.com
Sun Oct 28 02:42:13 CET 2007
Alan,
The problem is that I have another tool that has an initialization period when you start it up. I want to see how long it takes for it to start up or initialize. So, I set up the tool to startup and after it finishes the init stage, load up a file which has a custom procedure. Then run this custom procedure that executes an exit command. So, to time the entire init process, I want to use python. I first take a time stamp. Then execute the tool with os.system. Once it finishes, I take another time stamp. Subtract the two and get a general time of execution or init for the other program. What do you think?
python newbie...
----- Original Message ----
From: Alan Gauld <alan.gauld at btinternet.com>
To: tutor at python.org
Sent: Saturday, October 27, 2007 4:09:35 PM
Subject: Re: [Tutor] system call
"Eric Walker" <sli1que at yahoo.com> wrote
> I am trying to run a timing script but I need the python program
> to stop and wait for the executable to finish. Does anyone have
> any examples of doing this?
There are several ways to do it depending on what exactly
you are trying to do. We need a bit more detail.
If the "timing script" is an externalo program then if you run
it using os.system() your code will wait(ie block) until system()
returms - which is when the program executed exits.
However os.system() is a bit of a blunt tool and
often not the best solution. If we know what the
real problem is we might do better.
--
Alan Gauld
Author of the Learn to Program web site
http://www.freenetpages.co.uk/hp/alan.gauld
_______________________________________________
Tutor maillist - Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20071027/1f0ab92d/attachment-0001.htm
More information about the Tutor
mailing list