def onerror(function, path, excinfo):
 if (not os.access(path, os.W_OK)):
  os.chmod(path, stat.S_IWUSR)
  function(path)
 else:
  raise

def onerror ( function , path , excinfo ) : if ( not os . access ( path , os . W_OK ) ) : os . chmod ( path , stat . S_IWUSR ) function ( path ) else : raise
error handler for shutil .