pycram.utils

Module for utility functions. This module must not import any pycram module (due to potential circular imports).

Module Contents

Classes

suppress_stdout_stderr

A context manager for doing a "deep suppression" of stdout and stderr in

class pycram.utils.suppress_stdout_stderr

Bases: object

A context manager for doing a “deep suppression” of stdout and stderr in Python, i.e. will suppress all prints, 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). Copied from https://stackoverflow.com/questions/11130156/suppress-stdout-stderr-print-from-python-functions

__enter__()
__exit__(*_)