From 997b22416874a3e7b984efc3d7c5c01352db5b0b Mon Sep 17 00:00:00 2001 From: Tzu-ping Chung Date: Fri, 9 Mar 2018 15:35:46 +0800 Subject: [PATCH] Python 2 and 3 compatibility subprocess.check_call does not have encoding= on Python 2. I really need to learn how delegator works. --- pipenv/core.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pipenv/core.py b/pipenv/core.py index 25c0fe5c..98c36745 100644 --- a/pipenv/core.py +++ b/pipenv/core.py @@ -369,12 +369,12 @@ def find_python_from_py(python): import subprocess for ver_arg in reversed(version_args): try: - python_exe = subprocess.check_output( - [py, ver_arg, '-c', 'import sys; print(sys.executable)'], - encoding=sys.getdefaultencoding(), - ).strip() + python_exe = subprocess.check_output([py, ver_arg, '-c', 'import sys; print(sys.executable)']) except subprocess.CalledProcessError: continue + if not isinstance(python_exe, str): + python_exe = python_exe.decode(sys.getdefaultencoding()) + python_exe = python_exe.strip() version = python_version(python_exe) if (version or '').startswith(python): return python_exe