From 479519285cf44a50b8e2697fd1f4c7d1f67fb760 Mon Sep 17 00:00:00 2001 From: Simon Steuer Date: Thu, 4 Apr 2024 10:34:43 +0200 Subject: [PATCH] =?UTF-8?q?Vor=20dem=20Verschieben=20der=20Log-Datei=20wir?= =?UTF-8?q?d=20nun=20gepr=C3=BCft,=20ob=20die=20Log-Datei=20noch=20existie?= =?UTF-8?q?rt,=20da=20andernfalls=20eine=20FileNotFound-Exception=20ausgeg?= =?UTF-8?q?eben=20wurde,=20wenn=20die=20Ausf=C3=BChrung=20des=20DataPrepTo?= =?UTF-8?q?ols=20fehlerfrei=20funktioniert=20hat.=20In=20diesem=20Fall=20w?= =?UTF-8?q?urde=20die=20Log-Datei=20bisher=20gel=C3=B6scht,=20existierte?= =?UTF-8?q?=20folglich=20also=20nicht=20mehr,=20sobald=20shutil.move=20aus?= =?UTF-8?q?gef=C3=BChrt=20wurde?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/caditem.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lib/caditem.py b/lib/caditem.py index e7233d9..c27189a 100644 --- a/lib/caditem.py +++ b/lib/caditem.py @@ -885,6 +885,7 @@ class CadItem(DataModel): ret = False if re.findall(r'1 out of 1', content): + os.remove(path) self.message_info('Preparation sucessful', 'preparation_sucessful', {'path':impf_pfad}) ret = True elif re.findall(r'Error', content): @@ -894,7 +895,8 @@ class CadItem(DataModel): if not ret: log_editor = os.environ.get(r'LOG_EDITOR') subprocess.run(f"{log_editor} {path}") - shutil.move(path, self._controller.get_env('log')) + if os.path.exists(path): + shutil.move(path, self._controller.get_env('log')) return ret