def rmtree(path):
def handle_remove_readonly(func, path, exc):  <EOL><INDENT>excvalue = exc[<NUM_LIT:1>]<EOL>if (<EOL>func in (os.rmdir, os.remove, os.unlink) and<EOL>excvalue.errno == errno.EACCES<EOL>):<EOL><INDENT>os.chmod(path, stat.S_IRWXU | stat.S_IRWXG | stat.S_IRWXO)<EOL>func(path)<EOL><DEDENT>else:<EOL><INDENT>raise<EOL><DEDENT><DEDENT>shutil.rmtree(path, ignore_errors=False, onerror=handle_remove_readonly)<EOL>
On windows, rmtree fails for readonly dirs.