def rm_read_only(fn, tmp, info): if os.path.isfile(tmp): os.chmod(tmp, stat.S_IWRITE) os.remove(tmp) elif os.path.isdir(tmp): os.chmod(tmp, stat.S_IWRITE) shutil.rmtree(tmp) tmp = 'out' if os.path.isdir(tmp): shutil.rmtree(tmp, onerror=rm_read_only)
def rm_read_only(fn, tmp, info): if os.path.isfile(tmp): os.chmod(tmp, stat.S_IWRITE) os.remove(tmp) elif os.path.isdir(tmp): os.chmod(tmp, stat.S_IWRITE) shutil.rmtree(tmp) tmp = 'out' if os.path.isdir(tmp): shutil.rmtree(tmp, onerror=rm_read_only)