Skip to content

Commit 9f023f3

Browse files
authored
Merge pull request DonJayamanne#374 from IgorNovozhilov/0.4.1/bugfix/igornovozhilov/issue372
open file with encoding
2 parents 7b767e4 + bdb7d63 commit 9f023f3

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

pythonFiles/jedi/api/__init__.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,12 @@ def __init__(self, source=None, line=None, column=None, path=None,
8787
self.path = None if path is None else os.path.abspath(path)
8888

8989
if source is None:
90-
with open(path) as f:
91-
source = f.read()
90+
try:
91+
with open(path) as f:
92+
source = f.read()
93+
except:
94+
with open(path, encoding=encoding) as f:
95+
source = f.read()
9296

9397
self.source = common.source_to_unicode(source, encoding)
9498
lines = common.splitlines(self.source)

0 commit comments

Comments
 (0)