forked from VimPlug/jedi
Use force_unicode for all sys paths
This commit is contained in:
@@ -256,6 +256,8 @@ class Listener(object):
|
||||
try:
|
||||
result = False, self._run(*payload)
|
||||
except Exception as e:
|
||||
#import traceback
|
||||
#print_to_stderr(traceback.format_exc())
|
||||
result = True, e
|
||||
|
||||
pickle.dump(result, file=stdout, protocol=_PICKLE_PROTOCOL)
|
||||
|
||||
@@ -20,7 +20,7 @@ from parso.tree import search_ancestor
|
||||
from parso.cache import parser_cache
|
||||
from parso import python_bytes_to_unicode
|
||||
|
||||
from jedi._compatibility import unicode, ImplicitNSInfo
|
||||
from jedi._compatibility import unicode, ImplicitNSInfo, force_unicode
|
||||
from jedi import debug
|
||||
from jedi import settings
|
||||
from jedi.evaluate import sys_path
|
||||
@@ -254,12 +254,12 @@ class Importer(object):
|
||||
if self.import_path: # TODO is this check really needed?
|
||||
for path in sys_path.traverse_parents(self.file_path):
|
||||
if os.path.basename(path) == self.str_import_path[0]:
|
||||
in_path.append(os.path.dirname(path))
|
||||
in_path.append(force_unicode(os.path.dirname(path)))
|
||||
|
||||
# Since we know nothing about the call location of the sys.path,
|
||||
# it's a possibility that the current directory is the origin of
|
||||
# the Python execution.
|
||||
sys_path_mod.insert(0, os.path.dirname(self.file_path))
|
||||
sys_path_mod.insert(0, force_unicode(os.path.dirname(self.file_path)))
|
||||
|
||||
return in_path + sys_path_mod
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
from jedi._compatibility import force_unicode
|
||||
from jedi.evaluate.sys_path import detect_additional_paths
|
||||
from jedi.cache import memoize_method
|
||||
|
||||
@@ -30,4 +31,8 @@ class Project(object):
|
||||
if self._script_path is None:
|
||||
return sys_path
|
||||
|
||||
return sys_path + detect_additional_paths(self._evaluator, self._script_path)
|
||||
added_paths = map(
|
||||
force_unicode,
|
||||
detect_additional_paths(self._evaluator, self._script_path)
|
||||
)
|
||||
return sys_path + added_paths
|
||||
|
||||
Reference in New Issue
Block a user