On Fri, Apr 22, 2016 at 12:39 PM, Albert-Jan Roskam <sjeik_ap...@hotmail.com> wrote: > FYI, Just today I found out that shutil.rmtree raises a WindowsError if the > dir is read- > only (or its contents). Using 'ignore_errors', won't help. Sure, no error is > raised, but the > dir is not deleted either! A 'force' option would be a nice improvement.
Use the onerror handler to call os.chmod(path, stat.S_IWRITE). For example, see pip's rmtree_errorhandler: https://github.com/pypa/pip/blob/8.1.1/pip/utils/__init__.py#L105 -- https://mail.python.org/mailman/listinfo/python-list