Jupyter notebook input() not showing after using IPython display(markdown())

Viewed 730

I am trying to build a Chatbot using Jupyter Notebook on Google Colab. I am using IPython Markdown to better segregate the user conversations. User will key in their message using input() while the bot responses are IPython display(markdown()).

I am facing issues when i tried to print a starting messages (bot output before a user input). This error occurs approximately 50% of the time I run the script. No errors are faced if I did not print out the starting message. I have tried restarting the kernel but to no avail.

Does anyone know what is the reason for this and how I can fix it?

This is an example of a successful case. Successful example

This is an example of a failed case. As you can see, the code is running indefinitely on the input() line. Failed to load

This is the sample code, where input() box does not pop up at times.

from IPython.display import Markdown, display

display(Markdown("*Alex:* Hello."))

input(">> You: ")
1 Answers

This seems to be a kind of bug in Jupyter notebook, described in the past years by many programmers. I was facing the same problem. After several tests I have found (at least in my code) that the problem disappears if print() functions are removed before input().

Related