From fa45531b8a78a788798e817254e6effcd970d4d4 Mon Sep 17 00:00:00 2001 From: Sylvain Leclerc Date: Thu, 31 Oct 2024 13:23:00 +0100 Subject: [PATCH] fix: fix file copy on windows when copying to different drive (#7) * fix: fix file copy on windows when copying to different drive Signed-off-by: Sylvain Leclerc --- src/antares_web_installer/gui/controller.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/antares_web_installer/gui/controller.py b/src/antares_web_installer/gui/controller.py index d05dc4c..bd5732d 100644 --- a/src/antares_web_installer/gui/controller.py +++ b/src/antares_web_installer/gui/controller.py @@ -3,6 +3,7 @@ ebarr: https://stackoverflow.com/questions/23947281/python-multiprocessing-redirect-stdout-of-a-child-process-to-a-tkinter-text """ +import shutil import typing from pathlib import Path from threading import Thread @@ -176,7 +177,7 @@ def update_log_file(self): # move log file into Antares logs directory new_log_file_path = self.get_target_dir().joinpath(self.log_file.parent.name, self.log_file.name) try: - self.log_file.replace(new_log_file_path) + shutil.move(str(self.log_file), str(new_log_file_path)) except FileNotFoundError as e: if new_log_file_path.exists(): logger.debug("Log file '{}' was already moved. Skip renaming step.".format(new_log_file_path))