Carnets
Carnets copied to clipboard
time.sleep() inside thread
The following script runs in all tested jupyter apps/progs, even juno, but carnets (plus) doesn't. The expression time.sleep(0.2) stops execution.
import threading
from IPython.display import display
import ipywidgets as widgets
import time
progress = widgets.FloatProgress(value=0.0, min=0.0, max=1.0)
def work(progress):
total = 100
for i in range(total):
time.sleep(0.2)
progress.value = float(i+1)/total
thread = threading.Thread(target=work, args=(progress,))
display(progress)
thread.start()
Thanks for raising this issue. I'll have a look, but given that the server and client are both running in threads, adding threads in the notebook and then sleeping is always difficult. You might be causing the notebook thread to sleep, instead of the thread created by the notebook.