I guess I am missing something obvious here… but, is it possible to display callback exceptions on jupyter?
E.g. using the following, arguably, contrived example:
- If there are no exceptions, everything works as expected. I.e. you get a Dynamic Map which gets updated as you move the mouse.
- If there is an exception in the
if
branch you get a traceback and, obviously, the DynamicMap never gets created. - If there is an exception in the
else
branch, then the “initial” DynamicMap gets created, but it, obviously never gets updated when you move the mouse and, more importantly, the traceback gets lost which means you can’t “easily” figure out what is the problem. Furthremore, as pointed out by @jazz here theprint()
function doesn’t print anything andbreakpoint
is ignored.
import holoviews as hv
import panel as pn
def callback(x, y):
if x is None or y is None:
# 1/0
return hv.Points([]).opts(title="No points yet")
else:
# 1/0
return hv.Points([(x, y)]).opts(title="%.3f - %.3f" % (x, y))
pointer = hv.streams.PointerXY()
dmap = hv.DynamicMap(callback, streams=[pointer])
pn.Row(dmap).servable()
if you run the same example with panel serve
then the traceback gets printed on the console without any issue. Is it possible to get the same traceback on jupyter, too?