[issue33240] shutil.rmtree fails if inner folder is open in Windows Explorer

Eryk Sun report at bugs.python.org
Sat Mar 20 20:29:42 EDT 2021


Eryk Sun <eryksun at gmail.com> added the comment:

> oh, I missed that a notification happens to the other process(es) in a 
> common case, a bit of retrying with backoff would actually make sense 

The other common problem with deleting an empty directory is when it's opened as the working directory of a process. This case fails as a sharing violation because the open doesn't share delete access. There's nothing reasonable to do about it without user interaction, which would be a complicated bit of code: find the process that has the directory open, display a message to the user in the desktop session of the process, and wait for a response. That's not a good candidate for the standard library.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33240>
_______________________________________


More information about the Python-bugs-list mailing list