From: Benjamin Braatz Date: Wed, 4 Aug 2021 01:33:50 +0000 (+0200) Subject: Bugfix: File deletion X-Git-Url: http://git.graph-it.com/?a=commitdiff_plain;h=5e72d96e28ab1ce67fb7030f95e0634f1a966f84;p=graphit%2Fcontrolpi-camera.git Bugfix: File deletion --- 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)