diff --git a/CHANGELOG.md b/CHANGELOG.md index f7cd27a3..299e924a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,7 @@ ## 2.4.1 / Unreleased - Fix some logging exceptions +- Fix exception in CLI config reader (Py2) ## 2.4.0 / 2018-05-30 diff --git a/wsgidav/server/server_cli.py b/wsgidav/server/server_cli.py index 8c98bd04..f70b1918 100644 --- a/wsgidav/server/server_cli.py +++ b/wsgidav/server/server_cli.py @@ -35,6 +35,7 @@ from __future__ import print_function import argparse +import io import json import logging import os @@ -223,12 +224,12 @@ def _readConfigFile(config_file, verbose): raise RuntimeError("Couldn't open configuration file '{}'.".format(config_file)) if config_file.endswith(".json"): - with open(config_file, mode="r", encoding="utf-8") as json_file: + with io.open(config_file, mode="r", encoding="utf-8") as json_file: # Minify the JSON file to strip embedded comments minified = jsmin(json_file.read()) return json.loads(minified) elif config_file.endswith(".yaml"): - with open(config_file, mode="r", encoding="utf-8") as yaml_file: + with io.open(config_file, mode="r", encoding="utf-8") as yaml_file: return yaml.safe_load(yaml_file) try: