From 9a9f42ee173f972157d0acd9529453f4118a5fcb Mon Sep 17 00:00:00 2001 From: Guillaume Brunin <32393981+gbrunin@users.noreply.github.com> Date: Mon, 4 Dec 2023 11:51:57 +0100 Subject: [PATCH] EventReport.stat file not found error handling (#281) * Updated the e-ph plotting script * Make use of decorators for band structures * Modified EventReport.stat to allow for paths that are not found on the local machine. * Clean up of old stuff. --- abipy/flowtk/events.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/abipy/flowtk/events.py b/abipy/flowtk/events.py index 99e2d0aaa..80b94bdc3 100644 --- a/abipy/flowtk/events.py +++ b/abipy/flowtk/events.py @@ -273,7 +273,10 @@ def __init__(self, filename: str, events=None): events: List of Event objects """ self.filename = os.path.abspath(filename) - self.stat = os.stat(self.filename) + try: + self.stat = os.stat(self.filename) + except FileNotFoundError: + self.stat = None self.start_datetime, self.end_datetime = None, None self._events = []