From a51475d265fab0361c35608a3204dbbd0c5a1df8 Mon Sep 17 00:00:00 2001 From: cologler Date: Wed, 9 Nov 2016 07:48:45 +0800 Subject: [PATCH] Update __init__.py fix the source file read mode issue. if use 'r' mode, this may raise a `UnicodeDecodeError`. --- jedi/api/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/jedi/api/__init__.py b/jedi/api/__init__.py index 491c5e2e..d4439100 100644 --- a/jedi/api/__init__.py +++ b/jedi/api/__init__.py @@ -105,7 +105,7 @@ class Script(object): if source is None: # TODO add a better warning than the traceback! - with open(path) as f: + with open(path, 'rb') as f: source = f.read() self._source = common.source_to_unicode(source, encoding)