New submission from Chris Jerdonek <chris.jerdo...@gmail.com>: The Python documentation says that the html module (defining html.escape()) is new in Python 3.2:
http://docs.python.org/dev/library/html.html However, it's importable in Python 3.1, but without the escape() function. See below for evidence. This prevents the usual EAFP code from not working: try: # Python 3.2 deprecates cgi.escape() and adds the html module as a replacement. import html except ImportError: import cgi as html > python Python 3.1.4 (default, Apr 10 2012, 21:58:25) [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import html >>> html.escape Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'escape' >>> dir(html) ['__builtins__', '__doc__', '__file__', '__name__', '__package__', '__path__'] >>> html.__file__ '/opt/local/Library/Frameworks/Python.framework/Versions/3.1/lib/python3.1/html/__init__.py' ---------- components: None messages: 158008 nosy: cjerdonek priority: normal severity: normal status: open title: html module should not be available in Python 3.1 type: behavior versions: Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue14545> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com