From a3ef9d0d80cfe12c347a9cc982837be4c9269c5b Mon Sep 17 00:00:00 2001 From: adityapro3 Date: Mon, 16 Dec 2024 17:45:41 +0530 Subject: [PATCH] Added my name in contributors.md and completed Improve error handling for missing password files #1 --- contributors.md | 2 ++ manager.py | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 contributors.md diff --git a/contributors.md b/contributors.md new file mode 100644 index 0000000..8ccaa8e --- /dev/null +++ b/contributors.md @@ -0,0 +1,2 @@ + +Aditya Sharma diff --git a/manager.py b/manager.py index 212f675..fc41e8f 100644 --- a/manager.py +++ b/manager.py @@ -25,10 +25,13 @@ def create_password_file(self, path, initial_values=None): def load_password_file(self, path): self.password_file = path - with open(path, 'r') as f: - for line in f: - site, encrypted = line.split(":") - self.password_dict[site] = Fernet(self.key).decrypt(encrypted.encode()).decode() + try: + with open(path, 'r') as f: + for line in f: + site, encrypted = line.split(":") + self.password_dict[site] = Fernet(self.key).decrypt(encrypted.encode()).decode() + except: + print("Sorry, But looks like there is no file") def add_password(self, site, password): self.password_dict[site] = password