Skip to content

Commit bdb7d63

Browse files
try...except...
1 parent 46d23f8 commit bdb7d63

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, encoding=encoding) 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)