[Tutor] system call
sli1que at yahoo.com
Sun Oct 28 02:42:13 CET 2007
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?
----- 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.
Author of the Learn to Program web site
Tutor maillist - Tutor at python.org
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Tutor