ipylab icon indicating copy to clipboard operation
ipylab copied to clipboard

list_commands() not working

Open smith558 opened this issue 3 years ago • 3 comments

image

The command returns an empty list [].

smith558 avatar Jan 06 '23 14:01 smith558

Right, this is because the frontend might not be ready since everything is being executed in a single execute request.

Maybe using on_ready can help: https://github.com/jtpio/ipylab/blob/main/examples/commands.ipynb

jtpio avatar Jan 08 '23 19:01 jtpio

@jtpio Thanks! Will try that.

smith558 avatar Jan 08 '23 19:01 smith558

@jtpio I've recently found a way of doing this without needing the callback and waits for the frontend to be ready in a single request.


from ipylab import JupyterFrontEnd
from jupyter_ui_poll import run_ui_poll_loop
app = JupyterFrontEnd()
func = lambda: None if app.commands.list_commands() == [] else app.commands.list_commands()
print (run_ui_poll_loop(func))

artttt avatar Jan 24 '23 05:01 artttt