From a88469c6d770e61577ee7408778baef20bddf31b Mon Sep 17 00:00:00 2001 From: Silvio Rhatto Date: Thu, 16 May 2019 14:16:22 -0300 Subject: Check if file exists before attempt to get sha256sum --- ckandumper | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ckandumper b/ckandumper index f633215..a6e945a 100755 --- a/ckandumper +++ b/ckandumper @@ -94,10 +94,11 @@ class DownloadMultiple: output.write(str(datetime.datetime.now()) + '\n') output.close() - content = open(local_filename, 'rb') - output = open(local_filename + '.sha256', 'w') - output.write(sha256(content.read()).hexdigest() + ' ' + os.path.basename(local_filename) + '\n') - output.close() + if os.path.exists(local_filename): + content = open(local_filename, 'rb') + output = open(local_filename + '.sha256', 'w') + output.write(sha256(content.read()).hexdigest() + ' ' + os.path.basename(local_filename) + '\n') + output.close() if not str(proc.returncode) in self.globalstats['exitstatus']: self.globalstats['exitstatus'][str(proc.returncode)] = [] -- cgit v1.2.3