From 2e33a119408ee64f906ef8e49fccce022fabf6ef Mon Sep 17 00:00:00 2001 From: Danny Rehelis Date: Sat, 7 Mar 2020 15:54:50 +0200 Subject: [PATCH 1/2] replace forward slash FileNotFoundError: [Errno 2] No such file or directory: 'logs/processes/Group_add/remove_a_member__200307_134140.log' --- src/execution/logging.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/execution/logging.py b/src/execution/logging.py index 4beed206..f5a92b82 100644 --- a/src/execution/logging.py +++ b/src/execution/logging.py @@ -367,7 +367,7 @@ def create_filename(self, execution_id, all_audit_names, script_name, start_time if not filename.lower().endswith('.log'): filename += '.log' - filename = filename.replace(" ", "_") + filename = filename.replace(" ", "_").replace("/", "_") return filename From af78926292962c23f779b75a9b55a98de807901b Mon Sep 17 00:00:00 2001 From: Danny Rehelis Date: Sat, 7 Mar 2020 19:21:14 +0200 Subject: [PATCH 2/2] don't use forward slash in date_format --- src/tests/execution_filename_test.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tests/execution_filename_test.py b/src/tests/execution_filename_test.py index 8a8420f2..4ac1ca1c 100644 --- a/src/tests/execution_filename_test.py +++ b/src/tests/execution_filename_test.py @@ -12,8 +12,8 @@ def test_default_format(self): self.assertEqual(filename, 'my_script_bugy_180506_083026.log') def test_custom_date_format(self): - filename = self.create_filename(date_format='xx%y/%m/%d-%fxx') - self.assertEqual(filename, 'my_script_bugy_xx18/05/06-234000xx.log') + filename = self.create_filename(date_format='xx%y-%m-%d_%fxx') + self.assertEqual(filename, 'my_script_bugy_xx18-05-06_234000xx.log') def test_custom_name_id_only(self): filename = self.create_filename(filename_pattern='$ID')