Occasional OSError: [Errno 13] Permission denied on Windows

Patrick Maupin pmaupin at gmail.com
Thu Jan 5 14:27:54 EST 2006

Tim Peters wrote:

> In that case, anything that burns some time and tries again
>  will work better.  Replacing gc.collect() with time.sleep() is
>  an easy way to test that hypothesis; because gc.collect()
> does an all-generations collection, it can consume measurable time.

An slight enhancement to this hypothesis-tester (which might even
approach being production-worthy) would be to maintain a list of items
which were not deleted on a particular pass.  Sleep after each pass,
then try to kill all the items on the list again.  Maintain a counter
of the number of passes which have been made since the last time the
undeleted item list shrank (via a completed deletion), and if the total
time exceeds 'x' or the number of passes since a completed deletion
exceeds 'y', then bail and ask the user to help you out.


More information about the Python-list mailing list