From 315c19af87a353b29a8bf94adf59c3b2c3185e16 Mon Sep 17 00:00:00 2001 From: Thinh Nguyen Date: Fri, 28 Jun 2024 15:49:21 -0500 Subject: [PATCH] fix: additional safeguard to close the file and delete the `tffl` object --- element_interface/prairie_view_loader.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/element_interface/prairie_view_loader.py b/element_interface/prairie_view_loader.py index 97a0efa..6f701ae 100644 --- a/element_interface/prairie_view_loader.py +++ b/element_interface/prairie_view_loader.py @@ -180,6 +180,10 @@ def write_single_bigtiff( "'fps'": self.meta["frame_rate"], }, ) + # additional safeguard to close the file and delete the object + # in the attempt to prevent error: `not a TIFF file b''` + tffl.close() + del tffl except Exception as e: raise Exception(f"Error in processing tiff file {input_file}: {e}")