Skip to content

Commit 976da66

Browse files
committed
Sometimes for output to clear in JupyterLab (don't know why)
1 parent fb92e13 commit 976da66

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

afar/_printing.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,8 +76,15 @@ def print_outputs_async(out, stderr_future, repr_future, stdout_future):
7676
try:
7777
stdout_val = stdout_future.result()
7878
out.clear_output()
79+
count = 0
7980
while out.outputs:
8081
# See: https://github.com/jupyter-widgets/ipywidgets/issues/3260
82+
count += 1
83+
if count == 100: # 0.5 seconds
84+
# This doesn't appear to always clear correctly in JupyterLab.
85+
# I don't know why. I'm still investigating.
86+
out.outputs = type(out.outputs)() # is this safe?
87+
break
8188
sleep(0.005)
8289
if stdout_val:
8390
out.append_stdout(stdout_val)

0 commit comments

Comments
 (0)