From 2f8717ec97a971e499fcaf9cd2563eb4af34342c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lubom=C3=ADr=20Sedl=C3=A1=C5=99?= Date: Thu, 4 Apr 2019 11:42:19 +0200 Subject: [PATCH] Fix printing version on Python 3 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don't crash when getting version from installed package. Fixes: https://pagure.io/pungi/issue/1152 Signed-off-by: Lubomír Sedlář --- pungi/__init__.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pungi/__init__.py b/pungi/__init__.py index 0970d221..12ada28e 100644 --- a/pungi/__init__.py +++ b/pungi/__init__.py @@ -26,7 +26,9 @@ def get_full_version(): return re.sub(r'-1.fc\d\d?', '', output.strip().replace('pungi-', '')) else: import subprocess - proc = subprocess.Popen(["rpm", "-q", "pungi"], stdout=subprocess.PIPE) + proc = subprocess.Popen( + ["rpm", "-q", "pungi"], stdout=subprocess.PIPE, universal_newlines=True + ) (output, err) = proc.communicate() if not err: return output.rstrip()