def ask_program(message):
    """Ask the user to enter a path
    to a program.

    Look for it in PATH. If not found,
    ask the user to enter the full path.

    If still not found, give up ...
    """
    keep_going = True
    while keep_going:
        full_path = ask_string(message)
        if not full_path:
            break
        full_path = qisys.sh.to_native_path(full_path)
        if not os.path.exists(full_path):
            ui.error("%s does not exist" % full_path)
            keep_going = ask_yes_no("continue?")
            continue
        if not os.access(full_path, os.X_OK):
            ui.error("%s is not a valid executable!" % full_path)
            keep_going = ask_yes_no("continue?")
            continue
        return full_path
dataset/ETHPy150Open aldebaran/qibuild/python/qisys/interact.py/ask_program/original