Skip to content

startup

Helpers for startup script.

show_startup_error(title, message, detail=None)

Show startup error message.

This will trigger a subprocess with UI message dialog.

Parameters:

Name Type Description Default
title str

Message title.

required
message str

Message content.

required
Source code in common/ayon_common/startup/__init__.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
def show_startup_error(title, message, detail=None):
    """Show startup error message.

    This will trigger a subprocess with UI message dialog.

    Args:
        title (str): Message title.
        message (str): Message content.
    """

    current_dir = os.path.dirname(os.path.abspath(__file__))
    ui_dir = os.path.join(current_dir, "ui")
    script_path = os.path.join(ui_dir, "startup_error.py")
    with tempfile.NamedTemporaryFile(
        suffix=".json", delete=False
    ) as tmp:
        filepath = tmp.name

    with open(filepath, "w") as stream:
        json.dump(
            {
                "title": title,
                "message": message,
                "detail": detail,
            },
            stream
        )

    args = get_ayon_launch_args(
        script_path, "--skip-bootstrap", filepath
    )
    try:
        subprocess.call(args)
    finally:
        os.remove(filepath)