[Python-3000] lib2to3 refactor.py has a lot of 2.6-isms

Robert Brewer fumanchu at aminus.org
Fri Jul 25 06:39:34 CEST 2008


Raymond Hettinger wrote:
> The intended upgrade path is through 2.6.
> If you go straight from 2.5, you don't get
> to go through a step with the -3 warnings
> and optional text/bytes annotations.
> 
> IMO, it would be a mistake to create a 2.5 to 3.0 converter.
> 
> ----- Original Message -----
> From: "Robert Brewer" <fumanchu at aminus.org>
> To: "Python 3000" <python-3000 at python.org>
> Sent: Thursday, July 24, 2008 9:24 PM
> Subject: [Python-3000] lib2to3 refactor.py has a lot of 2.6-isms
> 
> 
> > The README at
> >
>
http://svn.python.org/view/sandbox/trunk/2to3/README?rev=65003&view=aut
> o
> > says: "2to3 must be run (at the moment) with Python 2.x!" However,
it
> > doesn't even import under 2.5.2 because of print() statements,
> > 'Exception as err', .relative imports, etc.
> >
> > Is this an attempt to make people upgrade to 2.6 before converting
to
> 3?
> > Or is the desire to eventually run under 3.0? If neither, would
y'all
> > welcome a version that ran under 2.5? I'd be happy to try my hand at
> > that.

That's fine by me. But every combination of refactor.py with 2.6 and 3.0
is also failing. Which combination is the preferred one so I can try to
fix it?

C:\Python25\Lib\site-packages>c:\python30\python
c:\python30\Lib\lib2to3\refactor.py --help
Traceback (most recent call last):
  File "c:\python30\Lib\lib2to3\refactor.py", line 25, in <module>
    from .pgen2 import driver
ValueError: Attempted relative import in non-package

C:\Python25\Lib\site-packages>c:\python26\python
c:\python30\Lib\lib2to3\refactor.py --help
  File "c:\python30\Lib\lib2to3\refactor.py", line 67
    print("At least one file or directory argument required.",
file=sys.stderr)
                                                                   ^
SyntaxError: invalid syntax

C:\Python25\Lib\site-packages>c:\python26\python
c:\python26\Lib\lib2to3\refactor.py --help
Traceback (most recent call last):
  File "c:\python26\Lib\lib2to3\refactor.py", line 25, in <module>
    from .pgen2 import driver
ValueError: Attempted relative import in non-package

C:\Python25\Lib\site-packages>c:\python30\python
c:\python26\Lib\lib2to3\refactor.py --help
  File "c:\python26\Lib\lib2to3\refactor.py", line 61
    print "Available transformations for the -f/--fix option:"
                                                             ^
SyntaxError: invalid syntax


Robert Brewer
fumanchu at aminus.org





More information about the Python-3000 mailing list