diff --git a/manager.py b/manager.py index 212f675..a6d9141 100644 --- a/manager.py +++ b/manager.py @@ -25,10 +25,15 @@ 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 FileNotFoundError: + print("Password file at ", path, "was not found. Please do check the file path and try again.") + except Exception as e: + print("An unexpected error occured: ", e) def add_password(self, site, password): self.password_dict[site] = password