From ba45a002dc96c6af6891e6119cd2f4d95f270b74 Mon Sep 17 00:00:00 2001 From: ZyX Date: Wed, 23 Apr 2014 06:31:42 +0400 Subject: [PATCH] Decode bytes before using os.path.join Otherwise it will raise TypeError when trying to join str() and bytes() instance in python-3.3. Fixes #654 Closes #655 --- powerline/lib/vcs/git.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/powerline/lib/vcs/git.py b/powerline/lib/vcs/git.py index 08edcd7f..d3d112fa 100644 --- a/powerline/lib/vcs/git.py +++ b/powerline/lib/vcs/git.py @@ -1,6 +1,9 @@ # vim:fileencoding=utf-8:noet +from __future__ import (unicode_literals, absolute_import, print_function) + import os +import sys import re from powerline.lib.vcs import get_branch_name as _get_branch_name, get_file_status @@ -26,7 +29,7 @@ def git_directory(directory): if os.path.isfile(path): with open(path, 'rb') as f: raw = f.read().partition(b':')[2].strip() - return os.path.abspath(os.path.join(directory, raw)) + return os.path.abspath(os.path.join(directory, raw.decode(sys.getfilesystemencoding() or 'utf-8'))) else: return path