[Python-Dev] Coernic Desktop Search versus shutil.rmtree

Tim Peters tim.peters at gmail.com
Thu Sep 2 16:37:03 CEST 2004


[Tim]
>> The cause:  Windows has low-level hooks for apps that want to
>> monitor changes to the filesystem.  For example, virus scanners
>> use those heavily.  Coernic also uses them, to reindex changed
>> files in the background.  So it can keep a file open beyond the time
>> Python thinks it deleted it, and then trying to rmdir its parent
>> directory fails (because the directory isn't really empty yet).

[Aahz]
> What happens when you use Windows Exploder to delete the folder?

I didn't try Explorer specifically.  Since I was in a DOS box anyway,
I used rmdir/s to clean it out.  I'm sure using Explorer would have
worked too.

This is a timing problem.  By the time I can click on the folder to
delete it in Explorer, or by the time I can type "rmdir/s xx",
Copernic is long done reindexing the files, so there's no problem
nuking the directory then.  shutil.rmtree issues the rmdir at machine
speed.


More information about the Python-Dev mailing list