Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion bagit.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import signal
import sys
import tempfile
import time
import unicodedata
import warnings
from collections import defaultdict
Expand Down Expand Up @@ -229,7 +230,16 @@ def make_bag(
_("Moving %(source)s to %(destination)s"),
{"source": temp_data, "destination": "data"},
)
os.rename(temp_data, "data")
while True:
try:
os.rename(temp_data, "data")
break
except PermissionError as e:
if hasattr(e, "winerror") and e.winerror == 5:
LOGGER.warning(_("PermissionError [WinError 5] when renaming temp folder. Retrying in 10 seconds..."))
time.sleep(10)
else:
raise

# permissions for the payload directory should match those of the
# original directory
Expand Down