Skip to content

Media asset

Media Asset Module

Defines the MediaAsset class for handling media file paths within assets.

MediaAsset #

MediaAsset(path: str)

Bases: BaseAsset

MediaAsset Class

Represents a media asset by storing the file path.

Parameters:

Name Type Description Default
path str

The file system path to the media asset.

required

Raises:

Type Description
FileNotFoundError

If the provided file path does not exist.

Parameters:

Name Type Description Default
path str

The file system path to the media asset.

required

Raises:

Type Description
FileNotFoundError

If the provided file path does not exist.

Source code in src/rapidata/rapidata_client/assets/media_asset.py
def __init__(self, path: str):
    """
    Initialize a MediaAsset instance.

    Args:
        path (str): The file system path to the media asset.

    Raises:
        FileNotFoundError: If the provided file path does not exist.
    """
    if not os.path.exists(path):
        raise FileNotFoundError(f"File not found: {path}, please provide a valid local file path.")
    self.path = path