From 3b496f05d68e64f6d0cc1d0c334584adae3851b1 Mon Sep 17 00:00:00 2001 From: OMOTO Kenji Date: Fri, 22 Dec 2017 11:28:01 +0900 Subject: [PATCH] Stdout of shell should be decoded with sys.getfilesystemencoding() --- distro.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/distro.py b/distro.py index e92b7fe..d23dcd6 100755 --- a/distro.py +++ b/distro.py @@ -920,7 +920,7 @@ def _get_lsb_release_info(self): stdout = subprocess.check_output(cmd, stderr=devnull) except OSError: # Command not found return {} - content = stdout.decode('UTF-8').splitlines() + content = stdout.decode(sys.getfilesystemencoding()).splitlines() return self._parse_lsb_release_content(content) @staticmethod @@ -939,7 +939,6 @@ def _parse_lsb_release_content(lines): """ props = {} for line in lines: - line = line.decode('utf-8') if isinstance(line, bytes) else line kv = line.strip('\n').split(':', 1) if len(kv) != 2: # Ignore lines without colon.