Exceptions

Public exception hierarchy for pyStrich.

Added in version 0.11: Unified exception hierarchy. All pyStrich-raised errors now inherit from PyStrichError; all pyStrich-emitted warnings inherit from PyStrichWarning.

exception PyStrichError[source]

Bases: Exception

Base class for all pyStrich-specific errors.

Added in version 0.11.

exception PyStrichInvalidInput[source]

Bases: PyStrichError

The text being encoded is not valid for the chosen barcode format.

Typically raised in response to end-user-supplied input.

Added in version 0.11.

exception PyStrichInvalidCheckDigit[source]

Bases: PyStrichInvalidInput

A supplied check digit is missing or does not match the computed one.

Raised by the check-digit formats (EAN-13, ITF-14) when require_valid_check_digit is set.

Added in version 0.19.

exception PyStrichInvalidPayloadLength[source]

Bases: PyStrichInvalidInput

The payload is too long to encode: it exceeds the chosen format’s capacity or the pyStrich input-length ceiling.

Added in version 0.19.

exception PyStrichInvalidOption[source]

Bases: PyStrichError

An encoder option (configuration argument) is invalid.

Typically a programmer error: options are usually hardcoded by the caller rather than passed through from end-user input.

Added in version 0.11.

exception PyStrichPillowNotInstalled(message: str = 'PNG output requires Pillow, an optional dependency of pyStrich. Install it with: pip install "pyStrich[png]"')[source]

Bases: PyStrichError

PNG output was requested but Pillow is not installed.

Pillow is an optional dependency, required only for PNG output.

Added in version 0.16.

exception PyStrichWarning[source]

Bases: UserWarning

Base class for pyStrich-specific warnings.

Added in version 0.11.

exception Fnc1WorkaroundCompatWarning[source]

Bases: PyStrichWarning

The legacy chr(231) FNC1 trick triggered the compat shim; use the FNC1 constant instead.

Added in version 0.11.

exception Code128MarkerBytesCompatWarning[source]

Bases: PyStrichWarning

The legacy \xf1..\xf4 FNC shortcut bytes in bare-str input triggered the compat shim; use Code128Data with the typed marker constants instead.

exception DataMatrixNonAsciiWarning[source]

Bases: PyStrichWarning

DataMatrix input contains non-ASCII characters; output will not decode correctly.

Added in version 0.11.