Error: Class my_comm_target not found in registry

53 views
Skip to first unread message

John

unread,
Nov 22, 2017, 5:30:17 PM11/22/17
to Project Jupyter
Hi

   I tried opening a Comm from the kernel as described in 


And I am getting the error

utils.js:910 Could not open comm  --  Error: Class my_comm_target not found in registry 
    at utils.js:874
    at new Promise (<anonymous>)
    at Object.load_class (utils.js:859)
    at CommManager.comm_open (comm.js:84)
    at i (jquery.min.js:4)
    at Kernel._handle_iopub_message (kernel.js:1223)
    at Kernel._finish_ws_message (kernel.js:1015)
    at kernel.js:1006
    at <anonymous>
(anonymous) @ utils.js:910
Promise rejected (async)
CommManager.comm_open @ comm.js:85
i @ jquery.min.js:4
Kernel._handle_iopub_message @ kernel.js:1223
Kernel._finish_ws_message @ kernel.js:1015
(anonymous) @ kernel.js:1006
Promise resolved (async)
Kernel._handle_ws_message @ kernel.js:1006
i @ jquery.min.js:4

I have have a custom javascript file called glowcomm.js that is installed at the location 

nbextensions/vpython_libraries/glowcomm.js

The javascript code comes from a python package called vpython that installs some custom javascript code to this location using

        notebook.nbextensions.install_nbextension(path = package_dir+"/vpython_libraries",overwrite = True,user = True,verbose = 0)


The contents of the glowcomm.js file looks like

define(["nbextensions/vpython_libraries/jquery-ui.custom.min",
        "nbextensions/vpython_libraries/glow.min"], function() {

var comm

IPython.notebook.kernel.comm_manager.register_target('my_comm_target',

What do I need to do to register "my_comm_target"  so that I don't get this error.

Error: Class my_comm_target not found in registry 



Thanks

John


Jason Grout

unread,
Nov 22, 2017, 7:10:37 PM11/22/17
to jup...@googlegroups.com
Can you turn on the browser debugger and have it pause on errors, and see what the lines of code are that are giving the problem (what are the lines of code, not just the line numbers)? I would probably debug this by also putting a breakpoint at the registration function and making sure that was working (i.e., step through the code and make sure that an entry was stored in the kernel's comm registry). I would also step through the code where the error happened and inspect the registry.



Thanks,

Jason


--
You received this message because you are subscribed to the Google Groups "Project Jupyter" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jupyter+u...@googlegroups.com.
To post to this group, send email to jup...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/jupyter/630e2d49-96e9-4f88-b927-42c36dfcf883%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

John

unread,
Nov 22, 2017, 10:12:30 PM11/22/17
to Project Jupyter
OK I figured out what my problem was. In my kernel python code I was setting up the comm channel with these two lines of code.

display(Javascript("""require(["nbextensions/vpython_libraries/glowcomm"], function(){console.log("GLOWCOMM LOADED");})"""))
comm = Comm(target_name='my_comm_target')

The first line would run javascript code which in turn registered the target on the javascript front end. The second line would connect to the target from the python side. If I put a time delay between these two commands then the problem goes away because the javascript code has time to execute to register the target to which I am trying to connect the Comm channel to.

Is there an alternative approach to ensure that the javascript file I require is loaded when the notebook is opened?

John

Jason Grout

unread,
Nov 23, 2017, 2:37:18 AM11/23/17
to jup...@googlegroups.com

Jason Grout

unread,
Nov 23, 2017, 2:39:34 AM11/23/17
to jup...@googlegroups.com
If you are using the display system and a mimetype to set up your rendering, you could possibly use the cookie cutter at https://github.com/jupyterlab/mimerender-cookiecutter to create the nbextension.

Jason

Reply all
Reply to author
Forward
0 new messages