summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoremkael <emkael@tlen.pl>2018-01-22 18:34:31 +0100
committeremkael <emkael@tlen.pl>2018-01-22 18:35:44 +0100
commit3c684269d94c10852197f41d144e0e9d65dd3a3b (patch)
tree5fe780ba13c74a051a0a66dea5c01e03cd4055f0
parentd20ee8df550eb0de822e536cbcba756fcbe340e1 (diff)
Decoding and encoding non-ascii config file path properly
-rw-r--r--jfr_playoff/settings.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/jfr_playoff/settings.py b/jfr_playoff/settings.py
index da92458..0bb61fc 100644
--- a/jfr_playoff/settings.py
+++ b/jfr_playoff/settings.py
@@ -15,7 +15,8 @@ class PlayoffSettings(object):
self.interactive = False
self.settings_file = None
if len(sys.argv) > 1:
- self.settings_file = sys.argv[1]
+ self.settings_file = sys.argv[1].decode(
+ sys.getfilesystemencoding())
else:
self.interactive = True
@@ -24,10 +25,11 @@ class PlayoffSettings(object):
readline.set_completer_delims(' \t\n;')
readline.parse_and_bind("tab: complete")
readline.set_completer(complete_filename)
- self.settings_file = raw_input('JSON settings file: ')
+ self.settings_file = raw_input(
+ 'JSON settings file: ').decode(sys.stdin.encoding)
if self.settings is None:
- self.settings = json.load(open(self.settings_file))
+ self.settings = json.load(open(unicode(self.settings_file)))
def has_section(self, key):
self.load()