11-24-2017 02:21 AM
Moving from Jupyter to CDSW I struggle to get along with the output console. Is it possible to suppress output of every single line from the source code? I find the output too verbose and would like to see the output from the print statements only.
When using Matplotlib I would also like to suppress the output from plots until I do the plt.show() command. In order to suppress text output from plt.hist(...) I do
_ = plt.hist(...)
Is there a better way of stopping CDSW from printing in the output console?
11-24-2017 04:17 AM
CDSW just uses the Jupyter kernel, so much of what you do in the Jupyter notebook would work here too. Magics will work. There's also an option to suppress this output in the output that is shared in the "Share" link, but that's not quite what you mean.
11-24-2017 05:01 AM - edited 11-24-2017 05:02 AM
I just discovered that putting a semicolon (;) at the very end of the code suppresses implicit output when running all lines. However, adding a semicolon at the end of a specific line seems to have no effect.
Googling these issues lead to the magic command capture, however, it seems to be of no use:
ERROR:root:Line magic function `%capture` not found (But cell magic `%%capture` exists, did you mean that instead?).
UsageError: %%capture is a cell magic, but the cell body is empty.
In other words, I still feel that I do not have control of the output. If I select a block of code I'd like to suppress the output of the source code when running this particular block.
I struggle to find information online about what magic commands (regarding output) are available in CDSW and how they work.