From 55a9fba677108e2ad8433d1d78fe42824dae446c Mon Sep 17 00:00:00 2001 From: Alexander Pacha Date: Mon, 22 Aug 2022 10:36:43 +0200 Subject: [PATCH] Small fix to raise an exception when no model was found instead of failing later with TypeError: 'int' object is not subscriptable. --- sbb_binarize/sbb_binarize.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/sbb_binarize/sbb_binarize.py b/sbb_binarize/sbb_binarize.py index 5424098..2f94785 100644 --- a/sbb_binarize/sbb_binarize.py +++ b/sbb_binarize/sbb_binarize.py @@ -34,7 +34,9 @@ class SbbBinarizer: self.start_new_session() self.model_files = glob('%s/*.h5' % self.model_dir) - + if not self.model_files: + raise ValueError(f"No models found in {self.model_dir}") + self.models = [] for model_file in self.model_files: self.models.append(self.load_model(model_file))