tetrak_ocr.errors

Exceptions raised by the package.

These exist mainly so that a missing optional backend fails as a library should — with a catchable exception naming the extra to install — rather than by printing to stderr and calling sys.exit(1), which is what the original scripts did. That was reasonable when each file was run directly; it is not, when a caller imports one backend and wants to fall back to another.

Exceptions

BackendWithdrawnError(backend, packages, reason)

A backend's extra has been withdrawn, so no pip install enables it.

InputRefusedError(path, reason)

A file was refused before any decoder read more than its header.

MissingBackendError(backend, extra, packages)

A backend was requested but its optional dependency is not installed.

MissingFeatureError(feature, extra, packages)

An option was asked for whose optional dependency is not installed.

MultiPageNotSupportedError(path, backend, ...)

A multi-frame image was given to a backend that reads only frame 0.

MultiPagePdfError(path, pages)

A searchable PDF was asked for on a document with more than one page.

OcrPipelineError

Base class for every error this package raises.

UnknownBackendError(name, known)

A backend name was requested that does not exist.

UnknownFormatError(name, valid)

An output format was requested that does not exist.