Python sh 模块,which() 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用sh.which()

项目:ledger-dashboard    作者:Ikke    | 项目源码 | 文件源码
def new(cls, filename):
        if hasattr(settings, 'LEDGER_BIN'):
            ledger_bin = settings.LEDGER_BIN
        else:
            ledger_bin = sh.which('ledger')

        return Ledger(sh.Command(ledger_bin).bake(_tty_out=False, no_color=True, file=filename), filename=filename)
项目:kyber    作者:TakumiHQ    | 项目源码 | 文件源码
def get_executable_path(executable):
    path = sh.which(executable)
    if path is None:
        raise Exception("Can't find '{}' executable, is it in your $PATH?".format(executable))
    return str(path)