From 6e6092e4b284cd9317a60d9abbc3a028f80a282f Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Fri, 25 Sep 2020 18:25:33 +0200 Subject: [PATCH] Do proper decapsulation for PiCamera wrapped object when reinitialized --- platypush/plugins/camera/pi/__init__.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/platypush/plugins/camera/pi/__init__.py b/platypush/plugins/camera/pi/__init__.py index 232f8805..8e98d2a7 100644 --- a/platypush/plugins/camera/pi/__init__.py +++ b/platypush/plugins/camera/pi/__init__.py @@ -147,13 +147,13 @@ class CameraPiPlugin(CameraPlugin): if not sock: continue - picam = self.open_device(**camera.info.to_dict()) if camera.object is None or camera.object.closed \ - else camera.object + if camera.object is None or camera.object.closed: + camera = self.open_device(**camera.info.to_dict()) try: - picam.start_recording(sock, format=stream_format) + camera.object.start_recording(sock, format=stream_format) while camera.stream_event.is_set(): - picam.wait_recording(1) + camera.object.wait_recording(1) except ConnectionError: self.logger.info('Client closed connection') finally: