File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 1212import signal
1313import sys
1414import tempfile
15+ import time
1516import unicodedata
1617import warnings
1718from collections import defaultdict
@@ -229,7 +230,16 @@ def make_bag(
229230 _ ("Moving %(source)s to %(destination)s" ),
230231 {"source" : temp_data , "destination" : "data" },
231232 )
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
233243
234244 # permissions for the payload directory should match those of the
235245 # original directory
You can’t perform that action at this time.
0 commit comments