Skip to content

Commit 880edc1

Browse files
committed
fix #496
1 parent 9d90149 commit 880edc1

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

pythonFiles/completion.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ def watch(self):
410410
jediPreview = False
411411
cachePrefix = 'v'
412412
if len(sys.argv) > 0 and sys.argv[1] == 'preview':
413-
jediPath = os.path.join(os.path.dirname(__file__), 'preview', 'jedi')
413+
jediPath = os.path.join(os.path.dirname(__file__), 'preview')
414414
jediPreview = True
415415
elif len(sys.argv) > 0 and sys.argv[1] == 'custom':
416416
jediPath = sys.argv[2]

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) 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)