[New-bugs-announce] [issue11644] 2to3 example.py is not a Python 2.x file

anatoly techtonik report at bugs.python.org
Wed Mar 23 00:59:56 CET 2011

New submission from anatoly techtonik <techtonik at gmail.com>:

http://docs.python.org/library/2to3.html#using-2to3 contains an example.py sample which is claimed to be Python 2.x source, but that's not true:

def greet(name):
    print "Hello, {0}!".format(name)
print "What's your name?"
name = raw_input()

The code is valid only for Python 2.6+. For previous versions it gives the following traceback:

Traceback (most recent call last):
  File "ewe.py", line 5, in <module>
  File "ewe.py", line 2, in greet
    print "Hello, {0}!".format(name)
AttributeError: 'str' object has no attribute 'format'

components: 2to3 (2.x to 3.0 conversion tool)
messages: 131817
nosy: techtonik
priority: normal
severity: normal
status: open
title: 2to3 example.py is not a Python 2.x file

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list