From b36d75137347198d48bebf8880ffe4710dce4e31 Mon Sep 17 00:00:00 2001
From: Remy Prechelt <prechelt@hawaii.edu>
Date: Tue, 1 Jun 2021 22:19:04 -1000
Subject: [PATCH] Make summary.yaml file optional for all outputs.

---
 python/corsika/io/outputs/output.py | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/python/corsika/io/outputs/output.py b/python/corsika/io/outputs/output.py
index 83a4c7928..fed4368aa 100644
--- a/python/corsika/io/outputs/output.py
+++ b/python/corsika/io/outputs/output.py
@@ -145,6 +145,9 @@ class Output(ABC):
         """
         Load the top-level summary from a given library path.
 
+        If there is not a summary file for this output, then an
+        empty dictionary is returned.
+
         Parameters
         ----------
         path: str
@@ -154,12 +157,11 @@ class Output(ABC):
         -------
         dict:
             The summary as a python dictionary.
-
-        Raises
-        ------
-        FileNotFoundError
-            If the summary file cannot be found
-
         """
-        with open(op.join(path, "summary.yaml"), "r") as f:
-            return yaml.load(f, Loader=yaml.Loader)
+
+        # if the summary file doesn't exist, we just an empty dict
+        if not op.exists(op.join(path, "summary.yaml")):
+            return {}
+        else:
+            with open(op.join(path, "summary.yaml"), "r") as f:
+                return yaml.load(f, Loader=yaml.Loader)
-- 
GitLab