From f4c4206a5304e2616ed938a6270da80b584e6c33 Mon Sep 17 00:00:00 2001 From: Richard Bowman Date: Thu, 11 Jan 2024 13:40:47 +0000 Subject: [PATCH] Return an empty scans list if the folder is missing --- src/openflexure_microscope_server/things/smart_scan.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/openflexure_microscope_server/things/smart_scan.py b/src/openflexure_microscope_server/things/smart_scan.py index 898fbebd..f3331e0d 100644 --- a/src/openflexure_microscope_server/things/smart_scan.py +++ b/src/openflexure_microscope_server/things/smart_scan.py @@ -650,6 +650,8 @@ class SmartScanThing(Thing): in the `images` folder. """ scans: list[ScanInfo] = [] + if not os.path.isdir(self.scans_folder_path): + return scans for f in os.listdir(self.scans_folder_path): path = os.path.join(self.scans_folder_path, f) if os.path.isdir(path):