ModuleUnavailable
(class from pyomo.common.dependencies)
- class pyomo.common.dependencies.ModuleUnavailable(name, message, version_error, import_error, package)[source]
Bases:
objectMock object that raises
DeferredImportErrorupon attribute accessThis object is returned by
attempt_import()in lieu of the module in the case that the module import fails. Any attempts to access attributes on this object will raise aDeferredImportErrorexception.- Parameters:
name (str) – The module name that was being imported
message (str) – The string message to return in the raised exception
version_error (str) – A string to add to the message if the module failed to import because it did not match the required version
import_error (str) – A string to add to the message documenting the Exception raised when the module failed to import.
package (str) – The module name that originally attempted the import
Methods
__init__(name, message, version_error, ...)generate_import_warning([logger])DEPRECATED.
log_import_warning([logger, msg])Log the import error message to the specified logger
mro()Return a type's method resolution order.
Member Documentation
- generate_import_warning(logger='pyomo.common')[source]
DEPRECATED.
Deprecated since version 6.0: use
log_import_warning()
- log_import_warning(logger='pyomo', msg=None)[source]
Log the import error message to the specified logger
This will log the the import error message to the specified logger. If
msg=is specified, it will override the default message passed to this instance ofModuleUnavailable.