forked from VimPlug/jedi
check_fs: handle FileNotFoundError
Ref: https://github.com/davidhalter/jedi-vim/pull/801
This commit is contained in:
committed by
Dave Halter
parent
bd7c65d963
commit
aa6857d22d
@@ -17,7 +17,8 @@ from parso.python import tree
|
|||||||
from parso.tree import search_ancestor
|
from parso.tree import search_ancestor
|
||||||
from parso import python_bytes_to_unicode
|
from parso import python_bytes_to_unicode
|
||||||
|
|
||||||
from jedi._compatibility import unicode, ImplicitNSInfo, force_unicode
|
from jedi._compatibility import (FileNotFoundError, ImplicitNSInfo,
|
||||||
|
force_unicode, unicode)
|
||||||
from jedi import debug
|
from jedi import debug
|
||||||
from jedi import settings
|
from jedi import settings
|
||||||
from jedi.parser_utils import get_cached_code_lines
|
from jedi.parser_utils import get_cached_code_lines
|
||||||
@@ -533,7 +534,11 @@ def get_modules_containing_name(evaluator, modules, name):
|
|||||||
yield path
|
yield path
|
||||||
|
|
||||||
def check_fs(path):
|
def check_fs(path):
|
||||||
with open(path, 'rb') as f:
|
try:
|
||||||
|
f = open(path, 'rb')
|
||||||
|
except FileNotFoundError:
|
||||||
|
return
|
||||||
|
with f:
|
||||||
code = python_bytes_to_unicode(f.read(), errors='replace')
|
code = python_bytes_to_unicode(f.read(), errors='replace')
|
||||||
if name in code:
|
if name in code:
|
||||||
e_sys_path = evaluator.get_sys_path()
|
e_sys_path = evaluator.get_sys_path()
|
||||||
|
|||||||
Reference in New Issue
Block a user