diff --git a/jedi/__init__.py b/jedi/__init__.py index ba0fa965..2df48271 100644 --- a/jedi/__init__.py +++ b/jedi/__init__.py @@ -43,5 +43,5 @@ from jedi.api import Script, Interpreter, set_debug_function, \ from jedi import settings from jedi.api.environment import find_virtualenvs, find_python_environments, \ get_default_environment, InvalidPythonEnvironment, create_environment, \ - find_executable, get_python_environment + get_python_environment from jedi.api.exceptions import InternalError diff --git a/jedi/api/environment.py b/jedi/api/environment.py index 357d1240..e3dd41bf 100644 --- a/jedi/api/environment.py +++ b/jedi/api/environment.py @@ -241,25 +241,25 @@ def _get_python_prefix(executable): # TODO: this function should probably return a list of environments since # multiple Python installations can be found on a system for the same version. -def get_python_environment(python): +def get_python_environment(name): """ Return the first Python environment found for a given path or for a string of the form 'pythonX.Y' where X and Y are the major and minor versions of Python. """ - exe = find_executable(python) + exe = find_executable(name) if exe: if exe == sys.executable: return SameEnvironment() return _Environment(_get_python_prefix(exe), exe) if os.name == 'nt': - match = re.search('python(\d+\.\d+)$', python) + match = re.search('python(\d+\.\d+)$', name) if match: version = match.group(1) for prefix, exe in _get_executables_from_windows_registry(version): return _Environment(prefix, exe) - raise InvalidPythonEnvironment("Cannot find executable %s." % python) + raise InvalidPythonEnvironment("Cannot find executable %s." % name) def create_environment(path, safe=True):