Skip to content

Commit

Permalink
fix(pip): improve error on python binary not being present (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
rchl authored Nov 15, 2023
1 parent 3a5dcf3 commit 7221a2c
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions st3/lsp_utils/pip_client_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
from .server_resource_interface import ServerResourceInterface
from LSP.plugin.core.typing import List, Optional
from os import path
import shutil
import sublime

__all__ = ['PipClientHandler']
Expand Down Expand Up @@ -61,8 +62,11 @@ def manages_server(cls) -> bool:
@classmethod
def get_server(cls) -> Optional[ServerResourceInterface]:
if not cls.__server:
cls.__server = ServerPipResource(cls.storage_path(), cls.package_name, cls.requirements_txt_path,
cls.server_filename, cls.get_python_binary())
python_binary = cls.get_python_binary()
if not shutil.which(python_binary):
raise Exception('Python binary "{}" not found!'.format(python_binary))
cls.__server = ServerPipResource(
cls.storage_path(), cls.package_name, cls.requirements_txt_path, cls.server_filename, python_binary)
return cls.__server

@classmethod
Expand Down

0 comments on commit 7221a2c

Please sign in to comment.