mosaik.util — Utility classes and functions

This module contains some utility functions and classes.

class mosaik.util.OrderedDefaultdict(*args, **kwargs)

Mixes OrderedDict with defaultdict.

mosaik.util.sync_process(generator, world, err_msg=None, ignore_errors=False)

Synchronously execute a SimPy process defined by the generator object generator.

A world instance is required to run the event loop.

You can optionally provide a err_msg that will be printed when the remote site unexpectedly closes its connection.

If ignore_errors is set to True, no errors will be printed.

mosaik.util.print_exception_and_exit(error, callback=None)

Print the error defined by the string or exception error, optionally calling callback.