taurus.core.util.whichexecutable

Find path of executable specified by filename

Functions

whichfile(filename, exts=None)[source]

Find path of executable specified by filename. It Takes into consideration the PATHEXT variable (found in MS Windows systems) to try also executable names extended with executable extensions.

Example:

# on a debian machine with taurus installed in the default path:
whichfile('taurus') --> '/usr/bin/taurus'

# or, on a winXP machine:
whichfile('command') --> 'C:\WINDOWS\system32\command.COM'
Parameters:
  • filename (str) – executable name.

  • exts (list<str>) – a list of valid executable extensions. If None given, the PATHEXT environmental variable is used if available.

Returns:

absolute path to the executable in the file system

Return type:

str