Skip to content

Commit 29598c3

Browse files
committed
Err handling
1 parent bfb109c commit 29598c3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/modules/ObjectDetectionCoral/tpu_runner.py‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -580,7 +580,7 @@ def init_pipe(self, options: Options) -> tuple:
580580
self.pipe = None
581581
logging.warning(f"TPU Exception creating interpreter: {tpu_ex}")
582582
error = "Failed to create interpreter (Coral issue)"
583-
except FileNotFoundError:
583+
except FileNotFoundError as ex:
584584
self.pipe = None
585585
logging.warning(f"Model file not found: {ex}")
586586
error = "Model file not found. Please download the model if possible"
@@ -741,6 +741,9 @@ def process_image(self,
741741
image: Image,
742742
score_threshold: float) -> (list, int, str):
743743
while True:
744+
# Sanity check
745+
assert self.pipe, "No processing pipeline, have we been initialized?"
746+
744747
try:
745748
return self._process_image(options, image, score_threshold)
746749
except queue.Empty:

0 commit comments

Comments
 (0)