Skip to content
Open
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
5 changes: 3 additions & 2 deletions sotodlib/toast/ops/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Full license can be found in the top level "LICENSE" file.

import os
import time
import pickle

from astropy import constants
Expand Down Expand Up @@ -89,13 +90,13 @@ def persistent_pickle_load(fname, n_try_max=6, wait_time=10):
try:
with open(fname, "rb") as f:
payload = pickle.load(f)
except EOFError:
except (EOFError, pickle.UnpicklingError):
if n_try == n_try_max - 1:
log.warning(f"EOF at {fname}, nothing loaded")
return None
else:
log.warning(f"EOF at {fname}, waiting for {wait_time} seconds")
sleep(wait_time)
time.sleep(wait_time)
continue
break # success

Expand Down
Loading