Set/get paths for external tools (pysb.pathfinder
)¶
- pysb.pathfinder.get_path(prog_name)[source]¶
Gets the currently active path to an external executable
The path will be determined automatically if not set (see return value). To override, call
set_path()
.- Parameters:
- prog_name: str
The PySB internal program name for an executable (run
list_programs()
for a list).
- Returns:
- The currently active path to an external executable. If the path hasn’t
- previously been set, the relevant environment variable for that
- program’s path will be searched. Failing that, a list of default paths
- for the operating system will be checked. An Exception is raised if none
- of these approaches works.
- pysb.pathfinder.list_programs()[source]¶
Return the list of available external programs as a dictionary
- Returns:
- A dictionary containing the internal program name (key) and the
- human-readable name and environment variable (value) to adjust the path
- for that program.
- pysb.pathfinder.set_path(prog_name, full_path)[source]¶
Sets the full path to an external executable at runtime
External program paths can also be adjusted by environment variable prior to first use; run
list_programs()
for a list of programs.- Parameters:
- prog_name: str
The internal program name for an executable. (see
list_programs()
)- full_path: str
The full path to the external executable or its enclosing directory. If the path is a directory, it will be searched for the executable. A ValueError will be raised if there’s an issue with the path (not found, permissions etc.).