[IPython-dev] 2to3 for IPython Notebook

Aron Ahmadia aron at ahmadia.net
Sun Nov 3 13:37:51 EST 2013


Hi Thomas,

Thanks for this.  Just to avoid confusion, let's keep the discussion in one
place, I propose the issue you linked, since I suspect Greg Wilson will
want to way in.

Cheers,
Aron


On Sun, Nov 3, 2013 at 12:14 PM, Thomas Kluyver <takowl at gmail.com> wrote:

>
> On 3 November 2013 01:17, Raniere Silva <ra092767 at ime.unicamp.br> wrote:
>
>> I need to convert some Python2 `print` statements to Python3 `print`
>> function
>> in .ipynb files. `2to3` didn't work. What tool I can use?
>>
>
>
> Copying my comment from the Software Carpentry Github thread here:
> https://github.com/swcarpentry/bc/issues/107
>
> We don't have an automated conversion tool for notebooks ourselves - we
> don't curate enough notebooks ourselves to really need one. However, it
> should be feasible to write something that loads a notebook, runs 2to3 on
> each of the code cells, and saves it again. I'm happy to help build that.
> It's not entirely trivial, though:
>
>    - Some changes should only be done once per notebook, e.g. adding from
>    __future__ imports.
>    - IPython special syntax, e.g. %magics might break the parser 2to3 is
>    using.
>
> Thanks,
>
> Thomas
>
>
> _______________________________________________
> 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/20131103/d165d837/attachment.html>


More information about the IPython-dev mailing list