Jupyter Notebook, Python3 Print Function: No Output, No Error

No output - Jupyter Notebook

I was able to solve this by Uninstalling tornado 6 and installing tornado 5.

5.1.1 is the last stable version and fixed my problem.

Referenced from Jupyter notebook: No connection to server because websocket connection fails

Print not showing in ipython notebook

I had a similar printing problem when my first code cell was:

import sys
reload(sys)
sys.setdefaultencoding("utf-8")

Then I've commented the second and third lines like this:

import sys
#reload(sys)
#sys.setdefaultencoding("utf-8")

Reset the kernel and re-ran the program and now my print statements are working properly.

Later on, I've found that when I was first having the printing problem, all print outputs were actually being sent to the ipython console terminal (on my Linux box), instead of being embed on the notebook.

How do you suppress output in Jupyter running IPython?

Add %%capture as the first line of the cell. eg

%%capture
print('Hello')
MyFunction()

This simply discards the output, but the %%capture magic can be used to save the output to a variable - consult the docs



Related Topics



Leave a reply



Submit