PYME.warnings module

class PYME.warnings.NoninteractiveContext

Bases: object

Context manager to indicate that we are running in a non-interactive environment - e.g. recipe execution. This will suppress wx.MessageBox warnings even if a GUI is available.

The code is used through the noninteractive singleton instance.

Example:

>>> with PYME.warnings.noninteractive:
>>>     # do something that might trigger a warning
>>>     # warning will be logged, but no GUI popup will be shown
PYME.warnings.warn(message, category=None, stacklevel=1, allow_cancel=False)