Get Notebook Metadata using Python

22 views
Skip to first unread message

Stefano Antonel

unread,
Feb 19, 2018, 10:08:56 AM2/19/18
to Project Jupyter
Hi I need to access the Notebook metadata using python.
I'm able to get it using javascript like IPython.notebook.metadata but I don't like it at all.
There is any option with python?

Stefano

Jason Grout

unread,
Feb 19, 2018, 10:17:30 AM2/19/18
to jup...@googlegroups.com
In general, the python (kernel) does not know if it is running code from a notebook, console, or some other service. The architecture is specifically designed to be agnostic that way to give you great power and flexibility in how to run code. For example, it's easy to run one cell from a notebook, open up a console to the same kernel, and run the next few bits of code from the console as you investigate the environment interactively outside of the notebook. As such, I don't know of any way to tell from a given piece of code being run that it is (a) sent from a notebook, and (b) get the metadata from the notebook.

Of course, if you are just talking about using the python kernel to open up a notebook file itself, you can retrieve the metadata by just reading in the notebook JSON.

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/52cb2e92-c5ea-46fd-a402-e19279dc3cb4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages