Eryk Sun <> added the comment:

Your case probably isn't due to a anti-malware filesystem filter. Explorer 
keeps handles open to directories to get updates via ReadDirectoryChangesExW. 
It opens watched directories with shared delete  access, so deleting the child 
succeeds. But as discussed above, the directory isn't unlinked from the parent 
until Explorer closes its handle. Apparently it's not fast enough on the 
systems you tested.

As a workaround, you can define an onerror handler for use with shutil.rmtree() 
that retries the rmdir() call in a loop for up to a given timeout period, such 
as 10 ms. For convenience, a handler that retries unlink() and rmdir() could be 
distributed with shutil. For ease of use, it could be enabled by default on 


Python tracker <>
Python-bugs-list mailing list

Reply via email to