[Tutor] 2to3 Help?

Alan Gauld alan.gauld at btinternet.com
Mon Jan 12 09:56:04 CET 2009


"Marco Petersen" <marco.m.petersen at gmail.com> wrote

>I have Python 3.0. I tried to use the 2to3 program included with the 
>interpreter to convert some scripts for Python 2.5 to Python 3.0 
>ones.
> When I try to start it form the Python command line, it says it is a 
> syntax error.
>

Its always best to send us an actual cut n paste of error messages.
Its not clear where the error is coming from by your desription, it 
could
be Python (most likely) or the shell.

> 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?

Just some guesses... I haven't got around to installing Python 3 yet.

Alan G. 




More information about the Tutor mailing list