force as str before decoding as unicode

This commit is contained in:
Alan Hamlett 2016-01-15 12:24:43 +01:00
parent 006341eb72
commit 8b59e46c64
1 changed files with 2 additions and 1 deletions

View File

@ -41,6 +41,7 @@ if is_py2:
if text is None:
return None
try:
text = str(text)
return text.decode('utf-8')
except:
try:
@ -282,7 +283,7 @@ def find_python_in_folder(folder, headless=True):
if not retcode and pattern.search(output):
return path
except:
log(DEBUG, u('Python Version Output: {0}').format(u(str(sys.exc_info()[1]))))
log(DEBUG, u('Python Version Output: {0}').format(u(sys.exc_info()[1])))
if headless:
path = find_python_in_folder(folder, headless=False)