# Revision history [back]

When the .show() method of a MixedIntegerLinearProgram prints something, it is usually sent in the standard output of the shell that called your script. So, if the method was called from a script in a terminal, cou can catch it as usually (e.g. with pipelines | or >).

If the command is launched from a ipython shell, it is catched by ipython and printed in the ipython shell. You can access to it as follows:

sage: p = MixedIntegerLinearProgram()
sage: from IPython.utils import io
sage: with io.capture_output() as captured:
....:     p.show()


Then you got the result in the captured object:

sage: captured
<IPython.utils.io.CapturedIO at 0xbf0916c>
sage: print captured
Maximization:

Constraints:
Variables:
sage: str(captured)
'Maximization:\n \nConstraints:\nVariables:\n'


When the .show() method of a MixedIntegerLinearProgram prints something, it is usually sent in the standard output of the shell that called your script. So, if the method was called from a script in a terminal, cou can catch it as usually (e.g. with pipelines | or >).

If the command is launched from a ipython shell, it is catched by ipython and printed in the ipython shell. You can access to it as follows:

sage: p = MixedIntegerLinearProgram()
sage: from IPython.utils import io
sage: with io.capture_output() as captured:
....:     p.show()


Then you got the result in the captured object:

sage: captured
<IPython.utils.io.CapturedIO at 0xbf0916c>
sage: print captured
Maximization:

Constraints:
Variables:
sage: str(captured)
'Maximization:\n \nConstraints:\nVariables:\n'


It both works on the sage command line and in the notebook.