]> gitweb.fluxo.info Git - ckandumper.git/commitdiff
Check if file exists before attempt to get sha256sum
authorSilvio Rhatto <rhatto@riseup.net>
Thu, 16 May 2019 17:16:22 +0000 (14:16 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Thu, 16 May 2019 17:16:22 +0000 (14:16 -0300)
ckandumper

index f63321509175ba977de138da66c49bc8df725eb3..a6e945a3e586a1b905293bccc94049383bfd4aea 100755 (executable)
@@ -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)] = []