We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 861ddac commit 7498a5eCopy full SHA for 7498a5e
1 file changed
bagit.py
@@ -12,6 +12,7 @@
12
import signal
13
import sys
14
import tempfile
15
+import time
16
import unicodedata
17
import warnings
18
from collections import defaultdict
@@ -229,7 +230,16 @@ def make_bag(
229
230
_("Moving %(source)s to %(destination)s"),
231
{"source": temp_data, "destination": "data"},
232
)
- os.rename(temp_data, "data")
233
+ while True:
234
+ try:
235
+ os.rename(temp_data, "data")
236
+ break
237
+ except PermissionError as e:
238
+ if hasattr(e, "winerror") and e.winerror == 5:
239
+ LOGGER.warning(_("PermissionError [WinError 5] when renaming temp folder. Retrying in 10 seconds..."))
240
+ time.sleep(10)
241
+ else:
242
+ raise
243
244
# permissions for the payload directory should match those of the
245
# original directory
0 commit comments