Re: [PythonReports-users] PythonReport - deprecation warning on et.getchildren
Brought to you by:
a1s
From: alexander s. <al...@go...> - 2012-12-20 17:43:04
|
Werner F. Bruhin wrote, at 20.12.2012 18:29: > > Error saving template file This method will be removed in future > versions. Use 'list(elem)' or iteration over elem instead. You mean, warning; this shouldn't be error. > I see the above for: > > builder.find_layout_parents > datatypes.writexml > > In both cases I could just change from: > > for _child in element.getchildren(): > > to: > > for _child in element: > > Is this fine or do you prefer a different fix? Sorry, no. The iterator interface is not documented prior to 2.7, and I also do not see it in the xml/etree/ElementTree.py source. And I don't grok how the list() trick could possibly work. There is getiterator() method, but it returns something completely different... So, unless there is solution acceptable for 2.4 the easiest way would be to ignore this warning (maybe add a filtering code to start-up script). I don't expect the deprecated method disappear until the end of Python2 life time, and for Python3 there is no wx. Best wishes, alex. |