Prevent ResourceWarning due to unclosed file

This commit is contained in:
sloria
2014-08-09 20:22:48 -04:00
parent 25188f0a5b
commit 57f0ceb111

View File

@@ -71,8 +71,8 @@ def load_config(filename='mkdocs.yml', options=None):
if 'config' in options:
filename = options['config']
assert os.path.exists(filename), "Config file '%s' does not exist." % filename
user_config = yaml.load(open(filename, 'r'))
with open(filename, 'r') as fp:
user_config = yaml.load(fp)
user_config.update(options)
return validate_config(user_config)