From af93f8576308e503ac513412d133e6e5d1c4a9fd Mon Sep 17 00:00:00 2001 From: Ville Rantanen Date: Sun, 18 Sep 2022 14:25:36 +0300 Subject: [PATCH] deal with empty data dir --- code/labeler.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/code/labeler.py b/code/labeler.py index 7f689bd..76c5dd8 100644 --- a/code/labeler.py +++ b/code/labeler.py @@ -92,7 +92,7 @@ def get_current_image(images): def get_image_list(): - return sorted( + image_list = sorted( [ os.path.join(app.config["IMAGEDIR"], x) for x in os.listdir(app.config["IMAGEDIR"]) @@ -100,6 +100,9 @@ def get_image_list(): ], key=natural_key, ) + if len(image_list) == 0: + return [None] + return image_list def get_metadata(imagepath): @@ -211,4 +214,4 @@ def show_image(id=None): labels=labels, id_minus=id_minus, id_plus=id_plus, - ) \ No newline at end of file + )