Skip to content

Commit

Permalink
Fix exception in CLI config reader (Py2)
Browse files Browse the repository at this point in the history
Update #111
  • Loading branch information
mar10 committed Jun 14, 2018
1 parent 621fbb0 commit e6016e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
5 changes: 3 additions & 2 deletions wsgidav/server/server_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
from __future__ import print_function

import argparse
import io
import json
import logging
import os
Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit e6016e1

Please sign in to comment.