class dcase_framework.utils.SuppressStdoutAndStderr[source]

Context manager to suppress STDOUT and STDERR

A context manager for doing a “deep suppression” of stdout and stderr in Python, i.e. will suppress all print, even if the print originates in a compiled C/Fortran sub-function. This will not suppress raised exceptions, since exceptions are printed to stderr just before a script exits, and after the context manager has exited (at least, I think that is why it lets exceptions through).

After: http://stackoverflow.com/questions/11130156/suppress-stdout-stderr-print-from-python-functions