From 196d43a2a44f783860afefec3710e87e9e885fdd Mon Sep 17 00:00:00 2001
From: Matthew Pitkin <matthew.pitkin@ligo.org>
Date: Thu, 29 Feb 2024 15:14:00 +0000
Subject: [PATCH] Update emcee.py: don't try loading checkpoint file it is has
 zero size

---
 bilby/core/sampler/emcee.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/bilby/core/sampler/emcee.py b/bilby/core/sampler/emcee.py
index 7253a0fa4..78539b826 100644
--- a/bilby/core/sampler/emcee.py
+++ b/bilby/core/sampler/emcee.py
@@ -310,7 +310,11 @@ class Emcee(MCMCSampler):
         """
         if hasattr(self, "_sampler"):
             pass
-        elif self.resume and os.path.isfile(self.checkpoint_info.sampler_file):
+        elif (
+            self.resume and
+            os.path.isfile(self.checkpoint_info.sampler_file) and
+            os.path.getsize(self.checkpoint_info.sampler_file)
+        ):
             import dill
 
             logger.info(
-- 
GitLab