From 70fb808dae82755ddcb06834831a34caa4642909 Mon Sep 17 00:00:00 2001 From: Bastian Kleineidam Date: Sat, 23 Feb 2013 13:36:46 +0100 Subject: [PATCH] Decode command output. Fixes Python3 test cases. --- patoolib/util.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/patoolib/util.py b/patoolib/util.py index 374c95e..faae4ca 100644 --- a/patoolib/util.py +++ b/patoolib/util.py @@ -114,9 +114,10 @@ class memoized (object): return self.func.__doc__ -def backtick (cmd): - """Return output from command.""" - return subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] +def backtick (cmd, encoding='utf-8'): + """Return decoded output from command.""" + data = subprocess.Popen(cmd, stdout=subprocess.PIPE).communicate()[0] + return data.decode(encoding) def run (cmd, **kwargs):