def exec_python_file(pth, args=None):
    """ Executes a python file and checks the return value """
    basedir = os.path.dirname(os.path.abspath(os.path.join(SETUP_DIR, pth))) + "/"
    print("\tRunning script:", Fore.YELLOW + Style.BRIGHT + pth + Style.RESET_ALL)
    pth = os.path.basename(pth)
    os.chdir(basedir)
    cmd = [sys.executable, "-B", pth] + (args or [])
    if CMD_ARGS.verbose:
        print("Executing", ' '.join(cmd))
        print("CWD is", basedir)
    try:
        output = subprocess.check_output(cmd, stderr=sys.stderr)
    except subprocess.CalledProcessError as msg:
        print(color("Failed to execute '" + pth + "'", Fore.YELLOW + Style.BRIGHT))
        print("Output:", msg, "\n", msg.output.decode("utf-8", errors="ignore"))
        error("Python script didn't return properly!")
    except __HOLE__ as msg:
        print("Python script error:", msg)
        error("Error during script execution")
    if CMD_ARGS.verbose:
        print(output.decode("utf-8", errors="ignore"))
    os.chdir(SETUP_DIR)
dataset/ETHPy150Open tobspr/RenderPipeline/setup.py/exec_python_file