New submission from kirpit:
xml.etree.ElementTree.Element's append method doesn't support iterator/sequence
parameters as it's supposed to, for the version 1.3.0.
Python 2.7.3 (default, Sep 14 2012, 09:52:31)
[GCC 4.2.1 Compatible Apple Clang 4.0 ((tags/Apple/clang-421.0.60))] on darwin
Type help, copyright, credits or license for more information.
import xml.etree.ElementTree as et
et.VERSION
'1.3.0'
root = et.Element('root')
sublist = [et.Element('sub'), et.Element('sub')]
root.append(sublist)
et.tostring(root)
Traceback (most recent call last):
File stdin, line 1, in module
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 1127, in tostring
ElementTree(element).write(file, encoding, method=method)
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 818, in write
self._root, encoding, default_namespace
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 878, in _namespaces
for elem in iterate():
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 477, in iter
for e in e.iter(tag):
AttributeError: 'list' object has no attribute 'iter'
root = et.Element('root')
root.append(iter(sublist))
et.tostring(root)
Traceback (most recent call last):
File stdin, line 1, in module
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 1127, in tostring
ElementTree(element).write(file, encoding, method=method)
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 818, in write
self._root, encoding, default_namespace
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 878, in _namespaces
for elem in iterate():
File
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/xml/etree/ElementTree.py,
line 477, in iter
for e in e.iter(tag):
AttributeError: 'listiterator' object has no attribute 'iter'
--
assignee: ronaldoussoren
components: Macintosh, XML
messages: 171255
nosy: kirpit, ronaldoussoren
priority: normal
severity: normal
status: open
title: xml.etree.ElementTree.Element: append method iterator param is broken
type: behavior
versions: Python 2.7
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16044
___
___
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com