[Tutor] 2to3 Help?

Kent Johnson kent37 at tds.net
Mon Jan 12 12:40:00 CET 2009


On Mon, Jan 12, 2009 at 3:56 AM, Alan Gauld <alan.gauld at btinternet.com> wrote:
> "Marco Petersen" <marco.m.petersen at gmail.com> wrote

>> This was the line of code:
>>
>> $ 2to3 testscript.py
>
> But I suspect...
> this will run your default python interpreter which is likely to still
> be your 2.5 version. THe convertion scrpt is almost certainly 3.0.
> So I think you will need to explicitly call the interpreter:
>
> $ some/path/to/python3 2to3 testscript.py
>
> Actually isn't 2to3 a .py file too? ie 2to3.py?

2to3 is a python program supplied with both Python 2.6 and 3.0. It is
a simple launcher that starts lib2to3.main(). It has a shebang line to
invoke the interpreter that, on my Mac at least, includes the complete
path.

That said, I too guess that somehow the OP has a mismatch between the
Python version running and the version of lib2to3 being used. I would
check on what is in 2to3.

Kent


More information about the Tutor mailing list