[Tutor] how to use 2to3

Danny Yoo dyoo at hashcollision.org
Mon Jan 13 20:25:14 CET 2014


On Mon, Jan 13, 2014 at 9:30 AM, S Tareq <stareq13 at yahoo.com> wrote:
> can you please help me how to use 2to3 on 3.3. i went to the web site follow
> instraction and it did not work.

When asking for debugging help, it is usually a very good idea to
provide as much detail about what you exactly did as you can.
Specifically, if you see an error message, copy and paste the error
message for people to see.  If you are running a set of commands, copy
and paste exactly what commands you are running.

Why is this important?  Because the people who want to help you will
need to _replicate_ the steps that you are doing.  Maybe you have made
a mistake in typing something.  Or maybe you've forgotten a step.
Without seeing what steps you have taken, we can not tell.

Or, in some cases, maybe the software itself is at fault.  Maybe the
problem is something entirely external.  Computers are complicated,
and a lot of things can break.  Again, we can not know that without
seeing the error message you are encountering as well.

So please provide more information.  Otherwise, we can not help you:
we simply don't have enough information!


According to:

    http://docs.python.org/2/library/2to3.html

you should be able to transform Python 2 programs to Python 3 programs
using the 2to3 program.


When I run the program 2to3 on your sample program, everything appears
to work fine.

################################################
dannyyoo at melchior:~$ 2to3 -w program.py
RefactoringTool: Skipping implicit fixer: buffer
RefactoringTool: Skipping implicit fixer: idioms
RefactoringTool: Skipping implicit fixer: set_literal
RefactoringTool: Skipping implicit fixer: ws_comma
RefactoringTool: Refactored foo.py
... [output omitted]
#################################################

and the resulting program.py does appear to use Python 3 conventions.


So I can not replicate or verify what you are seeing.


More information about the Tutor mailing list