Skip to content

Commit

Permalink
fix: don't crash if pip is not found (DEV-3256) (#791)
Browse files Browse the repository at this point in the history
  • Loading branch information
jnussbaum committed Feb 1, 2024
1 parent aba9aef commit 15f6e31
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dsp_tools/cli/entry_point.py
Expand Up @@ -119,8 +119,11 @@ def _parse_arguments(


def _get_version() -> str:
pip_freeze_output = subprocess.run("pip freeze".split(), check=False, capture_output=True).stdout.decode("utf-8")
dsp_tools_lines = [x for x in pip_freeze_output.split("\n") if "dsp-tools" in x]
try:
pip_output = subprocess.run("pip freeze".split(), check=False, capture_output=True).stdout.decode("utf-8")
dsp_tools_lines = [x for x in pip_output.split("\n") if "dsp-tools" in x]
except FileNotFoundError:
dsp_tools_lines = []
if not dsp_tools_lines:
# if the virtual environment was activated with env variables instead of executing activation commands,
# dsp-tools will run correctly, but "pip freeze" won't show dsp-tools
Expand Down

0 comments on commit 15f6e31

Please sign in to comment.