[IPython-dev] Get the running cell in javascript.

Matthias BUSSONNIER bussonniermatthias@gmail....
Fri Sep 27 06:39:58 CDT 2013


Le 27 sept. 2013 à 13:22, Marco Halder a écrit :

> Hello,
> 
> I'm experimenting with the javascript of the IPython notebook in  
> combination with cell magics.
> My Question is how do I get the running cell in javascript?
> 
> Using
> 
>     var cell = IPython.notebook.get_selected_cell();
> 
> gives me the next cell, not the one currently running. A stupid workaround is
> 
>     var cell =  
> IPython.notebook.get_prev_cell(IPython.notebook.get_selected_cell());


You cannot get the running cell as many cell can be submitted and you don't know when the processing of some code is started. 

You could track the submission order and pop cells when result are arrived then get the first cell in the stack. 
But then nothing can assure you that what is currently processed in the kernel is not something else from another frontend.

-- 
M


More information about the IPython-dev mailing list