From ec74d9c4a7f88f7ed7aeb9f8afc08eed440af87b Mon Sep 17 00:00:00 2001 From: Dustin Kirkland Date: Mon, 17 Mar 2014 10:32:43 +0900 Subject: [PATCH] * usr/lib/byobu/include/select-session.py: LP: #1279533 - quick hack to fix crashes when python can't figure out the encoding --- debian/changelog | 2 ++ usr/lib/byobu/include/select-session.py | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/debian/changelog b/debian/changelog index 2720ae0e..084b9185 100644 --- a/debian/changelog +++ b/debian/changelog @@ -19,6 +19,8 @@ byobu (5.75) unreleased; urgency=medium * usr/bin/byobu-launcher-uninstall.in, usr/bin/byobu-launch.in: LP: #1292228 - allow byobu-launch to pass arguments through to byobu-launcher - fix up the uninstallation of byobu launcher + * usr/lib/byobu/include/select-session.py: LP: #1279533 + - quick hack to fix crashes when python can't figure out the encoding [ Kosuke Asami ] * usr/lib/byobu/battery: LP: #1289157, #1289157 diff --git a/usr/lib/byobu/include/select-session.py b/usr/lib/byobu/include/select-session.py index 5c6cc2b7..88eb11fa 100755 --- a/usr/lib/byobu/include/select-session.py +++ b/usr/lib/byobu/include/select-session.py @@ -50,7 +50,9 @@ def get_sessions(): raise else: output = cpe.output - if not sys.stdout.encoding is None: + if sys.stdout.encoding is None: + output = output.decode("UTF-8") + else: output = output.decode(sys.stdout.encoding) if output: for s in output.splitlines(): @@ -63,7 +65,10 @@ def get_sessions(): i += 1 if BYOBU_BACKEND == "tmux": output = subprocess.Popen(["tmux", "list-sessions"], stdout=subprocess.PIPE).communicate()[0] - output = output.decode(sys.stdout.encoding) + if sys.stdout.encoding is None: + output = output.decode("UTF-8") + else: + output = output.decode(sys.stdout.encoding) if output: for s in output.splitlines(): if s: