[issue19643] shutil rmtree fails on readonly files in Windows

Paul Moore report at bugs.python.org
Tue Jan 21 17:13:26 CET 2014


Paul Moore added the comment:

Looks like that works. At least in my case - I just did

    def del_rw(action, name, exc):
        os.chmod(name, stat.S_IWRITE)
        os.remove(name)
    shutil.rmtree(path, onerror=del_rw)

Something more robust might check if name is a directory and os.rmdir that - I didn't need it for my case though.

Thanks.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue19643>
_______________________________________


More information about the Python-bugs-list mailing list