Skip to content

Conversation

mxschmitt
Copy link
Member

Fixes #163

except (PermissionError, NotADirectoryError):
for file in os.listdir(artifacts_folder.name):
try:
os.remove(os.path.join(artifacts_folder.name, file))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if we have a sub-directory there? Shouldn't this be rmtree? Alternatively, we can:

  • ignore the error and not cleanup;
  • retry artifacts_folder.cleanup() after a timeout;
  • implement smart recursive retrying like rimraf.

@mxschmitt mxschmitt merged commit ef99541 into main Oct 10, 2023
@mxschmitt mxschmitt deleted the bugfix/cleanup branch October 10, 2023 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

artifacts_folder.cleanup() raises PermissionError: [WinError 32]
2 participants