def onerror(function, path, excinfo):
    if not os.access(path, os.W_OK):
        # Is the error an access error?
        os.chmod(path, stat.S_IWUSR)
        function(path)
    else:
        raise


# Exact copy of 'spyderlib.utils.programs.is_program_installed' function
Error handler for `shutil.rmtree`.
dataset/ETHPy150Open winpython/winpython/winpython/utils.py/onerror