hydromt.model.Model.__exit__#
- Model.__exit__(exc_type, exc_value, traceback) None[source]#
Exit the model runtime context.
Ensures that resources associated with the model are properly released when leaving a
withblock, even if an exception occurred during its execution. This method delegates cleanup toclose().Example
with Model(root="path/to/model") as model: # This is where __enter__ is called model.setup_x() model.setup_y() model.write() # Exiting the with block will call __exit__, ensuring resources are cleaned up.
- Parameters:
exc_type (
typeorNone) – The type of the exception raised in thewithblock, orNoneif no exception occurred.exc_value (
BaseExceptionorNone) – The exception instance raised in thewithblock, orNone.traceback (
types.TracebackTypeorNone) – The traceback object associated with the exception, orNone.