Fix: shutil.SameFileError, removed "[INFO] Config Saved Successfully" print spam

This commit is contained in:
SnuffSocket committed 2024-10-15 02:47:48 +03:00
1 parent e85073a51d
commit 16edfe4d8f
1 file changed
+3 -1
+3 -1
View File
@@ -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")