Wait For Application Start

Michael Bentley michael at jedimindworks.com
Tue Sep 18 15:29:21 EDT 2007


On Sep 18, 2007, at 5:40 AM, Francesco Guerrieri wrote:

> On 9/18/07, Robert Rawlins - Think Blue
> <robert.rawlins at thinkbluemedia.co.uk> wrote:
>> This seems like a very logical method, but I'm not sure how to  
>> implement it
>> into my python code? Is there a simple way to make it wait for  
>> that file?
>> Without the need to build my own conditional loop?
>
> I'm not sure why how you could avoid a conditional loop. Could
> something like this work?
>
> import os.path
> import time
>
> while True:
>     if os.path.exists(YOUR_FILE):
>         break
>     time.sleep(30)

or

while not os.path.exists(YOUR_FILE):
     time.sleep(1)






More information about the Python-list mailing list