New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No error bubbling? #61
Comments
Thanks a lot for opening an issue. I suppose this is unexpected behavior. I am not sure what is causing this. I will have a look in two weeks. |
That is really weird. I could also see something similar in ipyleaflet today, see jupyter-widgets/ipyleaflet#455 (comment). I really don't know where this comes from. Maybe you already know about it, but you can use the |
Yes - the issue is more for debugging when it's hard to know where to capture output. I don't know why this might be happening, but the jupyter lab log console is discussed here: jupyterlab/jupyterlab#7386 They specifically mention un-handled messages being logged; I don't know how a message being "handled" is defined though. |
Here's my workaround: import traceback
class MyUI:
def __init__(self, canvas, model):
self.canvas = canvas
self.model = model
canvas.on_mouse_down(self.mouse_down)
def mouse_down(self, x, y):
try:
do_some_stuff()
except:
self.print_traceback()
def print_traceback(self):
self.canvas.fill_style = '#ff8888'
self.canvas.fill_rect(10, 10, 300, 300)
self.canvas.fill_style = '#000000'
s = traceback.format_exc()
for i, si in enumerate(s.split('\n')):
canvas.fill_text(si, 20, 30+15*i) Works great. Now my code is debugable. |
Looks like the CallbackDispatcher is consuming stdin and stdout for some reason. It's not about exceptions per se. Probably the exception is be handled in the normal way, but when the traceback is written to stdout, it gets consumed. |
that's a really neat workaround, thanks @kenseehart |
The CallbackDispatcher is being created a little bit differently in ipycanvas and the ipywidgets button. In the button it is created in the constructor: whereas here it is wrapped in at traitlets |
@ianhi do you think that could be the cause of the issue? Indeed having the object instantiated as a kind-of static property does not sound right at all. |
@martinRenou oops I forgot to include any context for that comparison. Yes, my intention was to imply that this may be the cause as this seems to be the only relevant difference between ipycanvas and the ipywidgets.Button |
Hi! Why is this issue closed? Is it fixed in the new versions? |
Hi @ahrm this issue is still open. You see this at the top of the page: |
Hi, if an exception is thrown during an interactive action, such as a callback invoked by
Canvas.on_mouse_down
, there seems to be no way of knowing this.e.g.:
by contrast, errors in
ipywidgets.Button
calls are reported in the jupyter lab log:Is it possible to match this behaviour?
The text was updated successfully, but these errors were encountered: