Merge pull request #545 from tintinweb/fix/FileNotFoundError

fix mythril signature db throwing FileNotFoundError when using mythril as a library
pull/551/head
Nikhil Parasaram 6 years ago committed by GitHub
commit 3d463c25d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 7
      mythril/support/signatures.py

@ -111,6 +111,8 @@ class SignatureDb(object):
:return: self
"""
path = path or self.signatures_file
directory = os.path.split(path)[0]
if sync and os.path.exists(path):
# reload and save if file exists
with open(path, "r") as f:
@ -122,7 +124,10 @@ class SignatureDb(object):
sigs.update(self.signatures) # reload file and merge cached sigs into what we load from file
self.signatures = sigs
if directory and not os.path.exists(directory):
os.makedirs(directory) # create folder structure if not existS
if not os.path.exists(path): # creates signatures.json file if it doesn't exist
open(path, "w").close()

Loading…
Cancel
Save