From f01091c4711cc77c9105c12b0b2e27c2de4622f3 Mon Sep 17 00:00:00 2001 From: Bas van Beek Date: Thu, 2 Apr 2020 12:57:35 +0200 Subject: [PATCH] Added a try/except clause for when rerun prevention is disabled self.hash() will return None if rerun prevention is disabled; f.write(None) thus raising a TypeError --- CAT/jobs.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/CAT/jobs.py b/CAT/jobs.py index b88597f5..c682e87f 100644 --- a/CAT/jobs.py +++ b/CAT/jobs.py @@ -226,9 +226,12 @@ def _finalize(self): self.status = 'successful' if self.settings.pickle: self.pickle() - filename = join(self.path, self.name + '.hash') + filename = join(self.path, f'{self.name}.hash') with open(filename, 'w') as f: - f.write(self.hash()) + try: # Will raise a TypeError if rerun prevetion is disabled + f.write(self.hash()) + except TypeError: + pass else: self.status = 'failed' else: