def load(path):
if not os.path.exists(path):
user = ave.pwd.getpwuid_name(os.getuid())
raise Exception(
'no such configuration file: %s\n\nrun "ave-config --bootstrap=%s" '
'to create one with default values' % (path, user)
)
config = None
with open(path) as f:
try:
config = json.load(f)
except Exception, e:
raise Exception(
'invalid config file %s: not valid JSON encoding: %s' % (path,e)
)
if type(config) != dict:
raise Exception(
'invalid config file %s: contents is not a dictionary: %s'
% (path, type(config))
)
return config
评论列表
文章目录