From 5e72d96e28ab1ce67fb7030f95e0634f1a966f84 Mon Sep 17 00:00:00 2001 From: Benjamin Braatz Date: Wed, 4 Aug 2021 03:33:50 +0200 Subject: [PATCH] Bugfix: File deletion --- controlpi_plugins/camera.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/controlpi_plugins/camera.py b/controlpi_plugins/camera.py index a363107..5459418 100644 --- a/controlpi_plugins/camera.py +++ b/controlpi_plugins/camera.py @@ -93,10 +93,10 @@ class Camera(BasePlugin): camera.awb_gains = gains while self._capture: while len(self._images) >= self.conf['keep']: - filename = self._images.popleft()[0] - filepath = os.path.join(self.conf['path'], - filename) - await aiofiles.os.remove(filepath) + file_name = self._images.popleft()[0] + file_path = os.path.join(self.conf['path'], + file_name) + await aiofiles.os.remove(file_path) timestamp = datetime.datetime.now() iso_time = timestamp.strftime('%Y-%m-%d %H:%M:%S') full_name = timestamp.strftime('%Y%m%d%H%M%S%f')+'.jpg' @@ -155,7 +155,7 @@ class Camera(BasePlugin): while len(self._images) > 0: file_name = self._images.popleft()[0] file_path = os.path.join(self.conf['path'], - filename) + file_name) os.remove(file_path) if os.path.isfile(web_path): os.remove(web_path) -- 2.34.1