From 56e4a384977d398a7e3b8249bac0253c67cd731a Mon Sep 17 00:00:00 2001 From: Mathis Hocke <mathis.hocke@fu-berlin.de> Date: Wed, 19 May 2021 15:47:50 +0200 Subject: [PATCH] Fix file not being closed in case of error in with block --- src/robofish/io/file.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/robofish/io/file.py b/src/robofish/io/file.py index 5d5742f..6a836a6 100644 --- a/src/robofish/io/file.py +++ b/src/robofish/io/file.py @@ -175,7 +175,7 @@ class File(h5py.File): if (type, value, traceback) == (None, None, None): if self.mode != "r": # No need to validate read only files (performance). self.validate() - self.close() + super().__exit__(type, value, traceback) def save_as(self, path: Union[str, Path], strict_validate: bool = True): """Save a copy of the file -- GitLab