Paul Moore added the comment:

It's similar. But the problem is that it only returns a list of errors, it 
doesn't let you address the error *while the rmtree is in progress*.

The key thing is that if you can fix the problem in onerror, you can avoid 
needing to restart the whole tree walk, which is the key aspect of rmtree.

As things stand, you can use the set_rw function I showed above, and run the 
rmtree twice:

    shutil.rmtree('path', onerror=set_rw)
    shutil.rmtree('path')

The first run fixes the error and then the second one deletes the remaining 
files. But this is clearly inefficient, and makes the limitations of "report 
errors to the user who can then address them" fairly obvious.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue19643>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to