From 699e7105eb35be9e0041b94b0707537101abd1fd Mon Sep 17 00:00:00 2001 From: Gabriele Girelli Date: Mon, 31 Aug 2020 10:55:51 +0200 Subject: [PATCH] Switched from warning to raising exception and improved message --- nd2reader/parser.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/nd2reader/parser.py b/nd2reader/parser.py index 0df1729..62243a3 100644 --- a/nd2reader/parser.py +++ b/nd2reader/parser.py @@ -256,7 +256,7 @@ class Parser(object): byte_ids = range(image_data_start+height*number_of_true_channels, len(image_group_data)-n_unwanted_bytes+1, height*number_of_true_channels) all_zero_bytes = all([0 == image_group_data[byte_ids[i]+i] for i in range(len(byte_ids))]) if not all_zero_bytes: - warnings.warn(f'Identified {n_unwanted_bytes} unwanted non-zero bytes in the ND2 file.') + raise Exception(f"{n_unwanted_bytes} unexpected non-zero bytes were found in the ND2 file, the file could not be parsed.") return all_zero_bytes def _remove_unwanted_bytes(self, image_group_data, image_data_start, height, width):