From 06620a4dbabb2647bd0e5cad6ee1cab13cac1949 Mon Sep 17 00:00:00 2001 From: Fuxino Date: Wed, 31 May 2023 19:07:50 +0200 Subject: [PATCH] Fix bug when exclude pattern is None --- .gitignore | 1 + simple_backup/simple_backup.py | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index f26b8e6..e2f2aaa 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ .idea/ +__pycache__/ test/ diff --git a/simple_backup/simple_backup.py b/simple_backup/simple_backup.py index b349f19..efcc66c 100755 --- a/simple_backup/simple_backup.py +++ b/simple_backup/simple_backup.py @@ -185,9 +185,10 @@ class Backup: fp.write('\n') with open(self._exclude_path, 'w') as fp: - for e in self.exclude: - fp.write(e) - fp.write('\n') + if self.exclude is not None: + for e in self.exclude: + fp.write(e) + fp.write('\n') if self.keep != -1 and self.remove_before: self.remove_old_backups()