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

John Omernik john at omernik.com
Fri Feb 6 21:43:04 EST 2015


Cool, that worked,  thank you. Is there a place that I could have
derived that from docs? I guess, I don't mind asking on list,
especially if others gain benefit, but I also try to figure things out
myself, and my research really led me nowhere. If there was a place
that wasn't coming up in my searches that would have helped, I'd like
to bookmark it.



On Fri, Feb 6, 2015 at 8:13 PM, Doug Blank <doug.blank at gmail.com> wrote:
> 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
>
>
>
> _______________________________________________
> 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