[IPython-dev] iPython 3.0 Creating a new notebook programatically.

Doug Blank doug.blank at gmail.com
Fri Feb 6 21:13:57 EST 2015


Two changes:

1) You should use a particular notebook format version:

nb = IPython.nbformat.v4.new_notebook()

2) Worksheet has been removed; so:

nb["cells"].append(IPython.nbformat.v4.new_code_cell("x = 1"))

Hope that helps,

-Doug

On Fri, Feb 6, 2015 at 8:59 PM, John Omernik <john at omernik.com> wrote:

> Hey all, I have been through the API docs for iPython 3, but I can't
> figure out how to reproduce this in iPython 3. (It worked in iPython
> 2.3)
>
> http://nbviewer.ipython.org/gist/fperez/9716279
>
> In iPython 3, I get an error at
> nb['worksheets'].append(nbf.new_worksheet(cells=cells))
>
> I tried some different stuff win imports. I.e. instead of
>
> from IPython.nbformat import current as nbf
>
> I did from iPython.nbformat import v4 as nbf and some other stuff to
> get write. But that's where I am currently stuck.  Any pointers would
> be helpful. Basically I want a code that will create a new notebook,
> and pre fill the few lines.
>
> Thanks!
>
> John
> _______________________________________________
> IPython-dev mailing list
> IPython-dev at scipy.org
> http://mail.scipy.org/mailman/listinfo/ipython-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/ipython-dev/attachments/20150206/53cbb87a/attachment.html>


More information about the IPython-dev mailing list