(func, path, exc_info)
| 92 | exception = None |
| 93 | |
| 94 | def on_rm_error(func, path, exc_info): |
| 95 | try: |
| 96 | os.chmod(path, stat.S_IWRITE | stat.S_IEXEC | stat.S_IREAD) |
| 97 | os.remove(path) |
| 98 | except Exception as e: |
| 99 | print('Failed to remove path ' + path + ': ' + str(e)) |
| 100 | nonlocal exception |
| 101 | if exception is None: |
| 102 | exception = e |
| 103 | |
| 104 | shutil.rmtree(folder, onerror=on_rm_error) |
| 105 | if exception: |