[IPython-dev] running/getting output into a new programmatically-generated notebook

Zoltán Vörös zvoros at gmail.com
Wed Mar 18 13:33:28 EDT 2015


On Wed, Mar 18, 2015 at 6:15 PM, Ana Nelson <ana at ananelson.com> wrote:

> Yes, thanks. Prefer a builtin tool so it stays in sync. runipy doesn't
> seem to be nbformat v4 compatible (at this time).
>
>
In the sense that it produces a v3 output. But it can still process v4
inputs.

By the way, I have just noticed that ipython3 creates v3 notebooks, while
ipython2 creates v4. Is this by accident?



> Currently calling it like this:
>
>         subprocess.check_output([
>             'ipython',
>             'nbconvert',
>             '--execute',
>             '--to', 'notebook',
>             '--output', nbPath,
>             nbPath
>             ])
>
>
>
> On Wed, Mar 18, 2015 at 10:03 AM, Thomas Kluyver <takowl at gmail.com> wrote:
>
>> Nbconvert now includes an execute preprocessor which executes a notebook,
>> recording the outputs back into that notebook. This is based on runipy,
>> which Zoltán mentioned, and you can use it either from Python code or at
>> the command line (ipython nbconvert --execute ...).
>>
>>
>> https://github.com/ipython/ipython/blob/master/IPython/nbconvert/preprocessors/execute.py
>>
>> Thomas
>>
>> On 18 March 2015 at 09:11, Ana Nelson <ana at ananelson.com> wrote:
>>
>>> I'm creating notebooks via nbformat following the pattern of Fernando's
>>> v4 gist:
>>> http://nbviewer.ipython.org/gist/fperez/b3ab79a32b0e4777a646
>>>
>>> (BTW it might be helpful to link to the new gist from the older version
>>> here http://nbviewer.ipython.org/gist/fperez/9716279)
>>>
>>> I'd like to run a command line script to populate the outputs in this
>>> notebook so that when a user opens the generated notebook, it has already
>>> been run.
>>>
>>> I thought that might have been the intention of the ipython -c '%run
>>> test.ipynb' command, but that doesn't seem to have any effect. Am I doing
>>> something wrong or is there some other command I should be calling?
>>>
>>> _______________________________________________
>>> 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
>>
>>
>
> _______________________________________________
> 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/20150318/33f50207/attachment.html>


More information about the IPython-dev mailing list