Skip to content

_base

plugin.workflow.applications.render

check_python_script_path(project_name, python_script_path)

Ensure the provided python script path exists.

Source code in client/ayon_workflow/plugins/workflow/applications/_base.py
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
def check_python_script_path(
        project_name: str,
        python_script_path: str,
    ) -> str:
    """ Ensure the provided python script path exists.
    """
    remap_script_path = remap_input(
        python_script_path,
        project_name,
    )

    if not os.path.exists(remap_script_path):
        raise ValueError(
            f"Unreachable python script {remap_script_path}."
        )

    return remap_script_path

get_temp_python_script_path(project_name, default_content, suffix_name='')

Create a temporary python script path from content.

Source code in client/ayon_workflow/plugins/workflow/applications/_base.py
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
def get_temp_python_script_path(
        project_name: str,
        default_content: str,
        suffix_name: str = "",
    ) -> Tuple[str]:
    """ Create a temporary python script path from content.
    """
    if not default_content:
        raise RuntimeError("Missing default render content.")

    suffix_name = f"_workflow_{suffix_name}"
    temp_dir = tempdir.get_temp_dir(project_name, suffix=suffix_name)
    with tempfile.NamedTemporaryFile(
        suffix=".py",
        mode="w",
        dir=temp_dir,
        delete=False
    ) as fhandler:
        fhandler.write(default_content)
        fhandler.flush()
        return temp_dir, fhandler.name