These are chat archives for ipython/ipython

23rd
Jun 2016
Stuart Nelson
@sutartmelson
Jun 23 2016 21:34
I'm trying to find documentation for kernel.execute. Can anyone point me in the right direction?
Even source code would be sufficient.
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:34
Here's the protocol spec:
And here's where do_execute is implemented
what are you looking for?
Stuart Nelson
@sutartmelson
Jun 23 2016 21:36
Trying to understand how callbacks work.
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:37
what callbacks?
Stuart Nelson
@sutartmelson
Jun 23 2016 21:37
I'm running some javascript code, and I want data to be returned from python back into javascript
kernel.execute(code_input, callbacks, {silent:false})
is somewhat working, but I dont fully understand it.
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:40
:)
I'm currently doing something very similar
Stuart Nelson
@sutartmelson
Jun 23 2016 21:41
Any luck?
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:41
yes and no
depending on what you are implementing
are you implementing an extension?
Stuart Nelson
@sutartmelson
Jun 23 2016 21:41
It seems like the callback is only executed when the command is putting something in std out.
No, although I might have to.
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:44
mmm
i can execute anything i think...
Stuart Nelson
@sutartmelson
Jun 23 2016 21:45
You working within jupyter?
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:46
var callback = function (data) { console.log(data.content); }
var callbacks = { shell : { reply : callback } };
Jupyter.notebook.kernel.execute("%%local\n ", callbacks);
that should work
var callback = function (data) { console.log(data.content); }
var callbacks = { shell : { reply : callback } };
Jupyter.notebook.kernel.execute("", callbacks);
the last 3 cells
sorry, didn't get your question
Stuart Nelson
@sutartmelson
Jun 23 2016 21:51
yeah it doesnt seem like there is nice documentation about it though. with parameter descriptions and such.
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:54
you could ask about documentation on jupyter ui at https://gitter.im/jupyter/notebook
there might be, but i don't know about it
you want documentation on the notebook and kernel objects for Jupyter
the way I got that code was to just look at the source code for the frontend part
Stuart Nelson
@sutartmelson
Jun 23 2016 21:55
Have you found the code for those functions?
kernel.execute I mean.
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 21:55
yeah... they're on github
Stuart Nelson
@sutartmelson
Jun 23 2016 21:56
I mean more specifically. I've been searching through the code but havent found it.
Stuart Nelson
@sutartmelson
Jun 23 2016 21:58
Sweet thank you!
Alejandro Guerrero Gonzalez
@aggFTW
Jun 23 2016 22:16
no worries!
Stuart Nelson
@sutartmelson
Jun 23 2016 22:21
So I've been having the command be a call to a python function.
Is there a way that you know of it have whatever that python function returns to be sent to the callback?
Stuart Nelson
@sutartmelson
Jun 23 2016 23:17
Does anyone know what the difference is between writing html inline using the %%html, or importing HTML from display and running it with HTML("html code")