vispy / jupyter_rfb

Remote Frame Buffer for Jupyter
https://jupyter-rfb.readthedocs.io
MIT License
55 stars 10 forks source link

Print calls and errors are swallowed #35

Closed almarklein closed 2 years ago

almarklein commented 2 years ago

In Jupyter lab:

In Jupyter notebook:

The difference in behavior between handle_event and get_frame can be explained by the fact that handle_event is processed during a com event, while get_frame is called in a fresh asyncio task.

This result surprises me quite a bit, since this is about basic prints and errors, and "Errors should never pass silently.". I guess async code is hard ... ?

I'm wondering whether this is something we should document or try to fix.

almarklein commented 2 years ago

If I make the widget call these methods using with self._output where the context is an ipywidgets.Output, I can fix it for the notebook. For Jupyter Lab it makes prints and errors appear in-line for handle_event, but for get_frame everything is swallowed ...

For reference, I did something similar to what is suggested here: https://github.com/matplotlib/ipympl/issues/116

djhoese commented 2 years ago

I agree it could be documented and that'd be a great first start. Would it be worth it to have the widget output include some option for including a stdout/stderr log in like a separate sub-widget or something? Eh probably not.