support utf-8 for configparser

pull/293/head
Nikhil Parasaram 7 years ago
parent 6937285399
commit a5a8cdaf9b
  1. 3
      .gitignore
  2. 4
      mythril/mythril.py

3
.gitignore vendored

@ -177,3 +177,6 @@ coverage_html_report/
tests/testdata/outputs_current/ tests/testdata/outputs_current/
tests/testdata/outputs_current_laser_result/ tests/testdata/outputs_current_laser_result/
tests/mythril_dir/signatures.json tests/mythril_dir/signatures.json
# VSCode
.vscode

@ -163,12 +163,12 @@ class Mythril(object):
config.set('defaults', "#– Linux: ~/.ethereum/geth/chaindata") config.set('defaults', "#– Linux: ~/.ethereum/geth/chaindata")
config.set('defaults', "#– Windows: %USERPROFILE%\\AppData\\Roaming\\Ethereum\\geth\\chaindata") config.set('defaults', "#– Windows: %USERPROFILE%\\AppData\\Roaming\\Ethereum\\geth\\chaindata")
config.set('defaults', 'leveldb_dir', fallback_dir) config.set('defaults', 'leveldb_dir', fallback_dir)
with codecs.open(config_path, 'w', 'utf-8') as fp: with open(config_path, 'w', 'utf-8') as fp:
config.write(fp) config.write(fp)
config = ConfigParser(allow_no_value=True) config = ConfigParser(allow_no_value=True)
config.optionxform = str config.optionxform = str
config.read(config_path) config.read(config_path, 'utf-8')
leveldb_dir = config.get('defaults', 'leveldb_dir', fallback=fallback_dir) leveldb_dir = config.get('defaults', 'leveldb_dir', fallback=fallback_dir)
return os.path.expanduser(leveldb_dir) return os.path.expanduser(leveldb_dir)

Loading…
Cancel
Save