def find_exe(name, filepath=None):
    """Find an executable.

    Args:
        name: Name of the program, eg 'python'.
        filepath: Path to executable, a search is performed if None.

    Returns:
        Path to the executable if found, otherwise an error is raised.
    """
    if filepath:
        if not os.path.exists(filepath):
            open(filepath)  # raise IOError
        elif not os.path.isfile(filepath):
            raise RezBindError("not a file: %s" % filepath)
    else:
        filepath = which(name)
        if not filepath:
            raise RezBindError("could not find executable: %s" % name)

    return filepath
def find_exe ( name , filepath = None ) : if filepath : if not os . path . exists ( filepath ) : open ( filepath ) elif not os . path . isfile ( filepath ) : raise RezBindError ( "not a file: %s" % filepath ) else : filepath = which ( name ) if not filepath : raise RezBindError ( "could not find executable: %s" % name ) return filepath
Find an executable.

    Args:
        name: Name of the program, eg 'python'.
        filepath: Path to executable, a search is performed if None.

    Returns:
        Path to the executable if found, otherwise an error is raised.