From cfb284d9ff7e354c4f8e03ffd3e83d5b251a2253 Mon Sep 17 00:00:00 2001 From: Simon-Martin Schroeder Date: Mon, 15 Jan 2024 15:58:54 +0100 Subject: [PATCH] Fix PermissionError on Windows --- experitur/core/trial_store.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/experitur/core/trial_store.py b/experitur/core/trial_store.py index a6e85e3..feaaebb 100644 --- a/experitur/core/trial_store.py +++ b/experitur/core/trial_store.py @@ -148,7 +148,8 @@ def __getitem__(self, trial_id): try: with open(path) as f: trial_data = yaml.load(f, Loader=yaml.Loader) - except (FileNotFoundError, IsADirectoryError) as exc: + except (FileNotFoundError, IsADirectoryError, PermissionError) as exc: + # Apparently, Windows raises a PermissionError instead of a IsADirectoryError raise KeyError(trial_id) from exc except: print(f"Error reading {path}")