Skip to content

errors

zarr.errors

ArrayNotFoundError

Bases: NodeNotFoundError

Raised when an array isn't found at a certain path.

Source code in zarr/errors.py
class ArrayNotFoundError(NodeNotFoundError):
    """
    Raised when an array isn't found at a certain path.
    """

    _msg = "No array found in store {!r} at path {!r}"

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

BaseZarrError

Bases: ValueError

Base error which all zarr errors are sub-classed from.

Source code in zarr/errors.py
class BaseZarrError(ValueError):
    """
    Base error which all zarr errors are sub-classed from.
    """

    _msg: str = "{}"

    def __init__(self, *args: object) -> None:
        """
        If a single argument is passed, treat it as a pre-formatted message.

        If multiple arguments are passed, they are used as arguments for a template string class
        variable. This behavior is deprecated.
        """
        if len(args) == 1:
            super().__init__(args[0])
        else:
            super().__init__(self._msg.format(*args))

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

ContainsArrayAndGroupError

Bases: BaseZarrError

Raised when both array and group metadata are found at the same path.

Source code in zarr/errors.py
class ContainsArrayAndGroupError(BaseZarrError):
    """Raised when both array and group metadata are found at the same path."""

    _msg = (
        "Array and group metadata documents (.zarray and .zgroup) were both found in store "
        "{!r} at path {!r}. "
        "Only one of these files may be present in a given directory / prefix. "
        "Remove the .zarray file, or the .zgroup file, or both."
    )

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

ContainsArrayError

Bases: BaseZarrError

Raised when an array already exists at a certain path.

Source code in zarr/errors.py
class ContainsArrayError(BaseZarrError):
    """Raised when an array already exists at a certain path."""

    _msg = "An array exists in store {!r} at path {!r}."

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

ContainsGroupError

Bases: BaseZarrError

Raised when a group already exists at a certain path.

Source code in zarr/errors.py
class ContainsGroupError(BaseZarrError):
    """Raised when a group already exists at a certain path."""

    _msg = "A group exists in store {!r} at path {!r}."

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

GroupNotFoundError

Bases: NodeNotFoundError

Raised when a group isn't found at a certain path.

Source code in zarr/errors.py
class GroupNotFoundError(NodeNotFoundError):
    """
    Raised when a group isn't found at a certain path.
    """

    _msg = "No group found in store {!r} at path {!r}"

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

MetadataValidationError

Bases: BaseZarrError

Raised when the Zarr metadata is invalid in some way

Source code in zarr/errors.py
class MetadataValidationError(BaseZarrError):
    """Raised when the Zarr metadata is invalid in some way"""

    _msg = "Invalid value for '{}'. Expected '{}'. Got '{}'."

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

NodeNotFoundError

Bases: BaseZarrError, FileNotFoundError

Raised when a node (array or group) is not found at a certain path.

Source code in zarr/errors.py
class NodeNotFoundError(BaseZarrError, FileNotFoundError):
    """
    Raised when a node (array or group) is not found at a certain path.
    """

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

NodeTypeValidationError

Bases: MetadataValidationError

Specialized exception when the node_type of the metadata document is incorrect.

This can be raised when the value is invalid or unexpected given the context, for example an 'array' node when we expected a 'group'.

Source code in zarr/errors.py
class NodeTypeValidationError(MetadataValidationError):
    """
    Specialized exception when the node_type of the metadata document is incorrect.

    This can be raised when the value is invalid or unexpected given the context,
    for example an 'array' node when we expected a 'group'.
    """

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

UnknownCodecError

Bases: BaseZarrError

Raised when a unknown codec was used.

Source code in zarr/errors.py
class UnknownCodecError(BaseZarrError):
    """
    Raised when a unknown codec was used.
    """

__init__

__init__(*args: object) -> None

If a single argument is passed, treat it as a pre-formatted message.

If multiple arguments are passed, they are used as arguments for a template string class variable. This behavior is deprecated.

Source code in zarr/errors.py
def __init__(self, *args: object) -> None:
    """
    If a single argument is passed, treat it as a pre-formatted message.

    If multiple arguments are passed, they are used as arguments for a template string class
    variable. This behavior is deprecated.
    """
    if len(args) == 1:
        super().__init__(args[0])
    else:
        super().__init__(self._msg.format(*args))

UnstableSpecificationWarning

Bases: ZarrFutureWarning

A warning raised to indicate that a feature is outside the Zarr specification.

Source code in zarr/errors.py
class UnstableSpecificationWarning(ZarrFutureWarning):
    """
    A warning raised to indicate that a feature is outside the Zarr specification.
    """

ZarrDeprecationWarning

Bases: DeprecationWarning

A warning raised to indicate that a feature will be removed in a future release.

Source code in zarr/errors.py
class ZarrDeprecationWarning(DeprecationWarning):
    """
    A warning raised to indicate that a feature will be removed in a future release.
    """

ZarrFutureWarning

Bases: FutureWarning

A warning intended for end users raised to indicate deprecated features.

Source code in zarr/errors.py
class ZarrFutureWarning(FutureWarning):
    """
    A warning intended for end users raised to indicate deprecated features.
    """

ZarrRuntimeWarning

Bases: RuntimeWarning

A warning for dubious runtime behavior.

Source code in zarr/errors.py
class ZarrRuntimeWarning(RuntimeWarning):
    """
    A warning for dubious runtime behavior.
    """

ZarrUserWarning

Bases: UserWarning

A warning raised to report problems with user code.

Source code in zarr/errors.py
class ZarrUserWarning(UserWarning):
    """
    A warning raised to report problems with user code.
    """