mirror of https://github.com/mvt-project/mvt.git
Catching PermissionError
This commit is contained in:
parent
09400a2847
commit
b847683717
|
@ -105,8 +105,12 @@ class Command(object):
|
|||
file_path = os.path.join(root, file)
|
||||
h = hashlib.sha256()
|
||||
|
||||
with open(file_path, "rb") as handle:
|
||||
h.update(handle.read())
|
||||
try:
|
||||
with open(file_path, "rb") as handle:
|
||||
h.update(handle.read())
|
||||
except PermissionError:
|
||||
log.error("Failed to hash the file %s: permission denied", file_path)
|
||||
continue
|
||||
|
||||
info["hashes"].append({
|
||||
"file_path": file_path,
|
||||
|
|
Loading…
Reference in New Issue