[IPython-dev] Get Notebook name in python
Jakob Gager
gager at ilsb.tuwien.ac.at
Wed Jun 4 17:19:13 EDT 2014
Thanks Min and Erik for the answers. Actually I was expecting such an
answer from Min, but I'm really happy to see this hackish approaches to
cope with this issue from Erik.
I thought there had to be some way, because a save call in the notebook
results in a printout of the filename in the terminal by the kernel.
I finally came up with a simple method like
def getname():
display(Javascript('IPython.notebook.kernel.execute("theNotebook = " +
"\'"+IPython.notebook.notebook_name+"\'");'))
return theNotebook
Jakob
Am 2014-06-04 18:17, schrieb Erik Bray:
> On Tue, Jun 3, 2014 at 5:01 PM, Jakob Gager <gager at ilsb.tuwien.ac.at> wrote:
>> Hy guys,
>>
>> is there a way to get the current notebook name in python? Something
>> similar to
>> the javascript IPython.notebook.notebook_name.
>>
>> Thanks for the help!
> There are a couple answers on Stack Overflow here:
> http://stackoverflow.com/questions/12544056/how-to-i-get-the-current-ipython-notebook-name
> Different answers for different IPython versions (mine now longer
> works on 2.0 :( ).
>
> That said, these are all hacks and most certainly unsupported and brittle.
>
> Erik
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
More information about the IPython-dev
mailing list