Vor dem Verschieben der Log-Datei wird nun geprüft, ob die Log-Datei noch existiert, da andernfalls eine FileNotFound-Exception ausgegeben wurde, wenn die Ausführung des DataPrepTools fehlerfrei funktioniert hat. In diesem Fall wurde die Log-Datei bisher gelöscht, existierte folglich also nicht mehr, sobald shutil.move ausgeführt wurde

This commit is contained in:
2024-04-04 10:34:43 +02:00
parent 14654ac367
commit 479519285c
+3 -1
View File
@@ -885,6 +885,7 @@ class CadItem(DataModel):
ret = False ret = False
if re.findall(r'1 out of 1', content): if re.findall(r'1 out of 1', content):
os.remove(path)
self.message_info('Preparation sucessful', 'preparation_sucessful', {'path':impf_pfad}) self.message_info('Preparation sucessful', 'preparation_sucessful', {'path':impf_pfad})
ret = True ret = True
elif re.findall(r'Error', content): elif re.findall(r'Error', content):
@@ -894,7 +895,8 @@ class CadItem(DataModel):
if not ret: if not ret:
log_editor = os.environ.get(r'LOG_EDITOR') log_editor = os.environ.get(r'LOG_EDITOR')
subprocess.run(f"{log_editor} {path}") 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 return ret