timing issue: shutil.rmtree and os.makedirs

Chris Angelico rosuav at gmail.com
Tue Jul 30 16:47:46 CEST 2013


On Tue, Jul 30, 2013 at 3:07 PM, Steven D'Aprano
<steve+comp.lang.python at pearwood.info> wrote:
> On Tue, 30 Jul 2013 14:27:10 +0100, Chris Angelico wrote:
>
>> for delay in 100,300,600,1000,3000,5000,10000:
>>   if not os.path.exists(directory): break
>>   sleep(delay)
>>
>> That'll sleep a maximum of 20 seconds, tune as required.
>
> Actually, that will sleep a maximum of 5.55 hours, and a minimum of 1.7
> minutes (assuming the directory doesn't get deleted instantaneously).
>
> time.sleep() takes an argument in seconds.

LOL! Whoops. That's what I get for not checking my docs. This is why
we have public responses, my errors can be caught by someone else.

ChrisA



More information about the Python-list mailing list