Use pathlib over split

pull/380/head
Nikhil Parasaram 6 years ago
parent 143ec422e9
commit a1b45f803e
  1. 3
      mythril/support/truffle.py

@ -1,4 +1,5 @@
import os import os
from pathlib import Path
import re import re
import sys import sys
import json import json
@ -31,7 +32,7 @@ def analyze_truffle_project(args):
try: try:
name = contractdata['contractName'] name = contractdata['contractName']
bytecode = contractdata['deployedBytecode'] bytecode = contractdata['deployedBytecode']
filename = contractdata['sourcePath'].split('/')[-1] filename = Path(contractdata['sourcePath']).name
except: except:
print("Unable to parse contract data. Please use Truffle 4 to compile your project.") print("Unable to parse contract data. Please use Truffle 4 to compile your project.")
sys.exit() sys.exit()

Loading…
Cancel
Save