Skip to content

Config utils

args_path_ensure_exists(file_path: str) -> Path

Returns a Path object containing the resolved file_path. Raises FileNotFoundError if the path does not exist.

Source code in opskrift/config_utils.py
 8
 9
10
11
12
13
14
15
16
17
def args_path_ensure_exists(file_path: str) -> Path:
    """Returns a `Path` object containing the resolved `file_path`.
    Raises `FileNotFoundError` if the path does not exist.
    """
    path = Path(file_path).resolve()

    if not path.exists():
        raise FileNotFoundError(errno.ENOENT, os.strerror(errno.ENOENT), str(path))

    return path