[IPython-dev] Using IPython API to create notebook

Thomas Kluyver takowl at gmail.com
Thu Nov 6 12:34:03 EST 2014


Hi Robert

On 6 November 2014 09:26, Robert Alexander <roalexan at microsoft.com> wrote:

> I'm trying to use the IPython API (see:
>
>
> http://ipython.org/ipython-doc/2/api/generated/IPython.html.services.notebooks.nbmanager.html#module-IPython.html.services.notebooks.nbmanager)
> to programmatically create a notebook in IPython 2.3.0, but hitting some
> problems. Here are the steps that I tried:
>
> The immediate problem is that importing a Python package does not
automatically import modules within that. To import that module, you would
do something like:

from IPython.html.services.notebooks import nbmanager

However, creating notebooks programmatically is easier with nbformat.
Create a notebook using new_notebook():

http://ipython.org/ipython-doc/2/api/generated/IPython.nbformat.v3.nbbase.html#module-IPython.nbformat.v3.nbbase

And save it using write():

http://ipython.org/ipython-doc/2/api/generated/IPython.nbformat.v3.nbbase.html#module-IPython.nbformat.v3.nbbase

Best wishes,
Thomas
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20141106/4e7b274b/attachment.html>


More information about the IPython-dev mailing list