Skip to content

Commit

Permalink
fix: cannot get python path when there are both Pipfile and .env
Browse files Browse the repository at this point in the history
sublimelsp/LSP-pyright#332

Signed-off-by: Jun-Fei Cherng <[email protected]>
  • Loading branch information
jfcherng committed Jun 3, 2024
1 parent a20c342 commit bbe0291
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,18 @@ def binary_from_python_path(path: str | Path) -> Path | None:
continue
print(f"{cls.name()}: INFO: {config_file} detected. Run subprocess command: {command}")
try:
python_path = subprocess.check_output(
stdout, stderr = subprocess.Popen(
command,
cwd=workspace_folder,
shell=True,
startupinfo=get_default_startupinfo(),
stderr=subprocess.STDOUT,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
universal_newlines=True,
).strip()
).communicate()
if stderr:
print(f"{cls.name()}: INFO: subprocess stderr: {stderr.strip()}")
python_path = stdout.strip()
if post_processing:
python_path = post_processing(python_path)
return Path(python_path) if python_path else None
Expand Down

0 comments on commit bbe0291

Please sign in to comment.