Skip to main content

ensure_dir

Function
This function is defined in the paths module.
Ensure a directory exists, creating it if necessary.

Signature

def ensure_dir(path: Union[str, Path]) -> Path

Parameters

path
Union
required
Directory path to ensure exists

Returns

Returns
Path
Path object for the directory

Usage

>>> from praisonaiagents.paths import ensure_dir, get_sessions_dir
    >>> sessions = ensure_dir(get_sessions_dir())

Uses

  • Path
  • path.mkdir

Source

View on GitHub

praisonaiagents/paths.py at line 312