find_executable
(function from pyomo.common.fileutils)
- pyomo.common.fileutils.find_executable(exename, cwd=True, include_PATH=True, pathlist=None)[source]
Find an executable using find_file to search typical locations.
Finds a specified executable by searching a specified set of paths. This routine will look for the specified file name, as well as looking for the filename followed by architecture-specific extensions (e.g.,
.exe). Note that as this usesfind_file(), the filename and search paths may contain wildcards.- Parameters:
exename (str) – The executable file name to search for
cwd (bool) – Start by looking in the current working directory [default: True]
include_PATH (bool) – Include the executable search PATH at the end of the list of directories to search. [default: True]
pathlist (str or list of str) – List of paths to search for the file. If None, then pathlist will default to the local Pyomo configuration binary directory. If a string, then the string is split using os.pathsep. [Default: None]
Notes
find_executable() uses
find_file()withallow_pathlist_deep_references=False, so search strings containing relative paths will only be matched relative to the current working directory. This prevents confusion in the case where a user calledfind_executable("./foo")and forgot to copyfoointo the local directory, but this function picked up anotherfooin the user’s PATH that they did not want to use.