From 76d8c4f01ad350cc9e5ce25aa6bb1ff4cca99a02 Mon Sep 17 00:00:00 2001 From: Sean C Date: Mon, 17 Apr 2023 00:34:32 -0400 Subject: [PATCH] Handle errors --- duplicateCheck.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/duplicateCheck.py b/duplicateCheck.py index ecb0393..9ccc354 100644 --- a/duplicateCheck.py +++ b/duplicateCheck.py @@ -14,6 +14,7 @@ def quickhash(filefullpath): return md5.digest() except OSError as er: print(f"Error hashing {filefullpath}") + return None def direcCrawler(): global directories, files @@ -34,6 +35,7 @@ def calchashes(): filehashes = {} for file in files: hash = quickhash(file) + if hash = None: continue ## Inefficient to use a catch on every non-duplicate (most of the files) try: filehashes[hash].append(file) except: filehashes[hash] = [file]