releso.util.module_import_raiser.ModuleImportRaiser

class releso.util.module_import_raiser.ModuleImportRaiser(lib_name: str, error_mesg: str | None = None)

Bases: object

Import error deferrer until it is actually called.

Class used to have better import error handling in the case that a package package is not installed. This is necessary due to that some packages are not a dependency of splinepy, but some parts require them to function. Examples are splinepy, torchvision, and imageio.

__init__(lib_name: str, error_mesg: str | None = None) None

Constructor of object of class ModuleImportRaiser.

Parameters:
  • lib_name (str) – Name of the library which can not be loaded. Will be inserted into the error message of the deferred import Error. Is not checked for correctness.

  • error_mesg (Optional[str], optional) – Original error msg. Defaults to None.