mirror of
https://github.com/jlu5/PyLink.git
synced 2024-11-01 01:09:22 +01:00
[WIP] conf: re-add 'fname' variable (used by REHASH)
This commit is contained in:
parent
3a57e8d595
commit
dce768017a
11
conf.py
11
conf.py
@ -31,16 +31,17 @@ def validateConf(conf):
|
||||
|
||||
return conf
|
||||
|
||||
def loadConf(fname, errors_fatal=True):
|
||||
def loadConf(filename, errors_fatal=True):
|
||||
"""Loads a PyLink configuration file from the filename given."""
|
||||
global confname, conf
|
||||
confname = fname.split('.', 1)[0]
|
||||
with open(fname, 'r') as f:
|
||||
global confname, conf, fname
|
||||
fname = filename
|
||||
confname = filename.split('.', 1)[0]
|
||||
with open(filename, 'r') as f:
|
||||
try:
|
||||
conf = yaml.load(f)
|
||||
conf = validateConf(conf)
|
||||
except Exception as e:
|
||||
print('ERROR: Failed to load config from %r: %s: %s' % (fname, type(e).__name__, e))
|
||||
print('ERROR: Failed to load config from %r: %s: %s' % (filename, type(e).__name__, e))
|
||||
if errors_fatal:
|
||||
sys.exit(4)
|
||||
raise
|
||||
|
Loading…
Reference in New Issue
Block a user