From 16edfe4d8f1e2e49ccde24717cf609f250b8901b Mon Sep 17 00:00:00 2001 From: SnuffSocket <82658601+SnuffSocket@users.noreply.github.com> Date: Sun, 6 Oct 2024 22:06:47 +0300 Subject: [PATCH] Fix: shutil.SameFileError, removed "[INFO] Config Saved Successfully" print spam --- BabbleApp/config.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BabbleApp/config.py b/BabbleApp/config.py index 2b740b0..9f313e7 100644 --- a/BabbleApp/config.py +++ b/BabbleApp/config.py @@ -83,9 +83,11 @@ class BabbleConfig(BaseModel): BabbleConfig(**json.load(settings_file)) shutil.copy(CONFIG_FILE_NAME, BACKUP_CONFIG_FILE_NAME) # print("Backed up settings files.") # Comment out because it's too loud. + except shutil.SameFileError: + pass except json.JSONDecodeError: # No backup because the saved settings file is broken. pass with open(CONFIG_FILE_NAME, "w") as settings_file: json.dump(obj=self.dict(), fp=settings_file, indent=2) - print("[INFO] Config Saved Successfully") + #print("[INFO] Config Saved Successfully")