to a human - about 2to3

Mark Lawrence breamoreboy at yahoo.co.uk
Wed May 1 13:49:21 EDT 2013


On 01/05/2013 15:52, Jennifer Butler wrote:
> Hiya
>
> I have trawled around your various pages and haven’t found what I want.
>
> I will start teaching Python to my pupils shortly. I have been looking
> for materials and have gathered a collection of programs. The problem is
> they are written in v2 and I have v3 installed in my classroom. I read
> about the 2to3 conversion program, but I can’t get it to work.
>
> Could you possibly give me a Noddy’s guide to do this?
>
> Thanks in anticipation.
>
> Jennifer J
>

Here's the help output.  I'd guess (as you don't specify exactly what 
doesn't work, 0/10, must try harder :) that you haven't specified -w, 
--write in which case the files don't get modified.

c:\Users\Mark\MyPython>2to3 --help
Usage: 2to3 [options] file|dir ...

Options:
   -h, --help            show this help message and exit
   -d, --doctests_only   Fix up doctests only
   -f FIX, --fix=FIX     Each FIX specifies a transformation; default: all
   -j PROCESSES, --processes=PROCESSES
                         Run 2to3 concurrently
   -x NOFIX, --nofix=NOFIX
                         Prevent a transformation from being run
   -l, --list-fixes      List available transformations
   -p, --print-function  Modify the grammar so that print() is a function
   -v, --verbose         More verbose logging
   --no-diffs            Don't show diffs of the refactoring
   -w, --write           Write back modified files
   -n, --nobackups       Don't write backups for modified files
   -o OUTPUT_DIR, --output-dir=OUTPUT_DIR
                         Put output files in this directory instead of
                         overwriting the input files.  Requires -n.
   -W, --write-unchanged-files
                         Also write files even if no changes were required
                         (useful with --output-dir); implies -w.
   --add-suffix=ADD_SUFFIX
                         Append this string to all output filenames. 
Requires
                         -n if non-empty.  ex: --add-suffix='3' will 
generate
                         .py3 files.


-- 
If you're using GoogleCrap™ please read this 
http://wiki.python.org/moin/GoogleGroupsPython.

Mark Lawrence




More information about the Python-list mailing list