From 88647962f4ed543ff689f0ed53b6bb604324db3e Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Tue, 4 Dec 2018 15:15:09 +0000 Subject: [PATCH] Closing microscope checks if hardware is attached --- openflexure_microscope/microscope.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index fb35dcd9..ed1c19d8 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -42,8 +42,10 @@ class Microscope(object): def close(self): """Shut down the microscope hardware.""" - self.camera.close() - self.stage.close() + if self.camera: + self.camera.close() + if self.stage: + self.stage.close() def attach(self, camera: StreamingCamera, stage: OpenFlexureStage, apply_config: bool=True): """