Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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: ")
like image 828
Goh Jia Yi Avatar asked Jan 29 '26 11:01

Goh Jia Yi


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().

like image 158
aprod Avatar answered Jan 31 '26 00:01

aprod



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!