From 3c684269d94c10852197f41d144e0e9d65dd3a3b Mon Sep 17 00:00:00 2001 From: emkael Date: Mon, 22 Jan 2018 18:34:31 +0100 Subject: Decoding and encoding non-ascii config file path properly --- jfr_playoff/settings.py | 8 +++++--- 1 file 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() -- cgit v1.2.3