From d6187a4e23d4d6d5dc4e6588b1f2f5e1bc47bbdb Mon Sep 17 00:00:00 2001 From: ColinDuquesnoy Date: Tue, 18 Mar 2014 19:19:35 +0100 Subject: [PATCH] Fix UnicodeDecodeError Open binary file in binary mode. This happens in py34 because they fixed the missing ``get_filename`` attribute of ExtensionLoader --- jedi/_compatibility.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index a862b74b..fdc11b6d 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -31,7 +31,8 @@ def find_module_py33(string, path=None): module_file = None else: module_path = loader.get_filename(string) - mode = 'rb' if module_path.endswith(".pyc") else 'r' + module_ext = os.path.splitext(module_path)[1] + mode = 'rb' if module_ext in ['.pyc', '.so', '.pyd'] else 'r' module_file = open(module_path, mode) except AttributeError: # ExtensionLoader has not attribute get_filename, instead it has a