kernel.core.redirector_output_trap

Module: kernel.core.redirector_output_trap

Inheritance diagram for IPython.kernel.core.redirector_output_trap:

Trap stdout/stderr, including at the OS level. Calls a callback with the output each time Python tries to write to the stdout or stderr.

RedirectorOutputTrap

class IPython.kernel.core.redirector_output_trap.RedirectorOutputTrap(out_callback, err_callback)

Bases: IPython.kernel.core.output_trap.OutputTrap

Object which can trap text sent to stdout and stderr.

__init__(out_callback, err_callback)
out_callback : callable called when there is output in the stdout err_callback : callable called when there is output in the stderr
on_err_write(string)
Callback called when there is some Python output on stderr.
on_out_write(string)
Callback called when there is some Python output on stdout.
set()
Set the hooks: set the redirectors and call the base class.
unset()
Remove the hooks: call the base class and stop the redirectors.