Skip to content

Commit 5b827c4

Browse files
committed
added back change to read the file with encoding
1 parent bd45579 commit 5b827c4

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pythonFiles/preview/jedi/api/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,12 @@ def __init__(self, source=None, line=None, column=None, path=None,
105105

106106
if source is None:
107107
# TODO add a better warning than the traceback!
108-
with open(path, 'rb') as f:
109-
source = f.read()
108+
try:
109+
with open(path) as f:
110+
source = f.read()
111+
except UnicodeDecodeError:
112+
with open(path, encoding=encoding) as f:
113+
source = f.read()
110114

111115
self._source = common.source_to_unicode(source, encoding)
112116
self._code_lines = common.splitlines(self._source)

0 commit comments

Comments
 (0)