File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -95,7 +95,9 @@ def save(results, checkpoint):
9595 break
9696 except PermissionError :
9797 time .sleep (0.01 )
98-
98+ else :
99+ print ("Warning: Could not save results due to persistent PermissionError." )
100+
99101 with open (checkpointPath + '.tmp' , 'wb' ) as file :
100102 pickle .dump (checkpoint , file )
101103 for _ in range (20 ):
@@ -104,6 +106,8 @@ def save(results, checkpoint):
104106 break
105107 except PermissionError :
106108 time .sleep (0.01 )
109+ else :
110+ print ("Warning: Could not save checkpoint due to persistent PermissionError." )
107111
108112 def loadResults ():
109113 if os .path .exists (resultsPath ):
@@ -179,7 +183,7 @@ def simulatePrisoners():
179183 for prisoner in prisoners :
180184 results [- 1 ]["prisoners" ].append ({"found" : prisoners [prisoner ][1 ], "checked_boxes" : prisoners [prisoner ][0 ]})
181185
182- saving .save (results , {"last_simulation" : sim , "rng_state" : rng .getstate ()})
186+ saving .save (results , {"last_simulation" : sim , "rng_state" : rng .getstate ()})
183187 print ("All simulations completed." )
184188
185189if __name__ == "__main__" :
You can’t perform that action at this time.
0 commit comments