From 968397fcfd6dab963781e47bc017b0b15aef77f1 Mon Sep 17 00:00:00 2001
From: Colm Talbot <colm.talbot@ligo.org>
Date: Tue, 5 Sep 2023 16:28:28 +0000
Subject: [PATCH] Resolve "Make bilby_result look for pickle result if passed
 result isn't present."

---
 bilby/core/result.py | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/bilby/core/result.py b/bilby/core/result.py
index 1c9914dc4..f7416a628 100644
--- a/bilby/core/result.py
+++ b/bilby/core/result.py
@@ -134,6 +134,16 @@ def read_in_result_list(filename_list, invalid="warning"):
     """
     results_list = []
     for filename in filename_list:
+        if (
+            not os.path.exists(filename)
+            and os.path.exists(f"{os.path.splitext(filename)[0]}.pkl")
+        ):
+            pickle_path = f"{os.path.splitext(filename)[0]}.pkl"
+            logger.warning(
+                f"Result file {filename} doesn't exist but {pickle_path} does. "
+                f"Using {pickle_path}."
+            )
+            filename = pickle_path
         try:
             results_list.append(read_in_result(filename=filename))
         except Exception as e:
-- 
GitLab