path, stat.S_IWRITE) #删除文件的只读属性
func(path) #再次执行删除操作
>>> shutil.rmtree...('D:\\des_test')
File "C:\Python35\lib\shutil.py", line 488, in rmtree
return _rmtree_unsafe(path..., onerror)
File "C:\Python35\lib\shutil.py", line 383, in _rmtree_unsafe
onerror(os.unlink, fullname..., sys.exc_info())
File "C:\Python35\lib\shutil.py", line 381, in _rmtree_unsafe
os.unlink(fullname...: 'D:\\des_test\\test1.txt'
>>> shutil.rmtree('D:\\des_test', onerror=remove_readonly) #指定回调函数,删除成功