Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions explain/agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,15 +49,15 @@ def find_binary(cls) -> Path | None:
Path to the agent binary, or None if not found

Raises:
FileNotFoundError: If the EXPLAIN_{AGENT}_PATH environment variable is set but the path
Exception: If the EXPLAIN_{AGENT}_PATH environment variable is set but the path
could not be found
"""
env_var = f"EXPLAIN_{cls.name.upper()}_PATH"
program = os.environ.get(env_var) or cls.program_name
if loc := shutil.which(program):
return Path(loc).absolute()
if os.environ.get(env_var):
raise FileNotFoundError(f"{env_var} is set to {program!r} but it could not be found.")
raise Exception(f"{env_var} is set to {program!r} but it could not be found.")
return None

@abstractmethod
Expand Down
Loading