[IPython-dev] How to get the notebook name/path in the kernel?

Konrad Hinsen konrad.hinsen at fastmail.net
Fri Feb 28 02:51:29 EST 2014


Stephen Chan writes:

 >  We do provenance tracking in the KBase Narrative as well, or
 > rather, we have an infrastructure to do provenance tracking, but
 > only somewhat early stage integration with our IPython
 > environment. It might be interesting to compare notes at some
 > point.

Definitely. My experiments are on GitHub:

  http://github.com/khinsen/activepapers-python/tree/ipython

But for now there's just a kernel and a notebook manager, which don't
work together at all.

 > But back to your original question - the easiest way to do this
 > might be to bind a front end JS handler to a kernel ready event,
 > and have that push the notebook name into
 > os.environ['notebook_name']. We do that for some front end data
 > that needs to get back into the kernel.

Thanks, that sounds like a workable approach.

Unfortunately my JS knowledge is insufficient even for following
this advice. It seems to me that a front end JS handler would have
to be part of the JS code that the notebook server hands out to
the browser. Unless there is a mechanism for injecting JS code
from the kernel side. I guess I have some more googling to do...

Konrad.



More information about the IPython-dev mailing list