[elbe-devel] [PATCH 12/13] add an iter() implementation to treeutils

Manuel Traut manuel.traut at linutronix.de
Wed Dec 6 11:10:37 CET 2017


On Tue, Dec 05, 2017 at 05:24:57PM +0100, Torben Hohn wrote:
> On Thu, Nov 30, 2017 at 03:15:14PM +0100, Manuel Traut wrote:
> > this fixes
> > 
> > 00:20:44.776     for c in def_xml.node("/preseed"):
> > 00:20:44.776 TypeError: iter() returned non-iterator of type 'eiter'
> 
> errm... what is the point here ?
> 2to3 renames next () to __next__ () and then we add a next () fallback ?
> 
> is this still supposed to work with python 2 ?
> i hope that this error does not come from py3.

yes, it's needed to run the code in py2. Otherwise you'll get:

    00:20:44.776     for c in def_xml.node("/preseed"):
    00:20:44.776 TypeError: iter() returned non-iterator of type 'eiter'

I'll improve the commit message.

> 
> > 
> > Signed-off-by: Manuel Traut <manut at linutronix.de>
> > ---
> >  elbepack/treeutils.py | 3 +++
> >  1 file changed, 3 insertions(+)
> > 
> > diff --git a/elbepack/treeutils.py b/elbepack/treeutils.py
> > index 64b04a05..c998bde9 100644
> > --- a/elbepack/treeutils.py
> > +++ b/elbepack/treeutils.py
> > @@ -39,6 +39,9 @@ class eiter(object):
> >  
> >          return elem(n)
> >  
> > +    def next(self):
> > +        return self.__next__()
> > +
> >  class ebase(object):
> >      def __init__(self, et):
> >          self.et = et
> > -- 
> > 2.15.1
> > 
> > 
> > _______________________________________________
> > elbe-devel mailing list
> > elbe-devel at linutronix.de
> > https://lists.linutronix.de/mailman/listinfo/elbe-devel
> 
> -- 
> Mit freundlichen Grüßen
> Torben Hohn
> 
> Linutronix GmbH
> 
> Standort: Bremen
> 
> Phone: +49 7556 25 999 18; Fax.: +49 7556 25 999 99
> 
> Firmensitz / Registered Office: D-88690 Uhldingen, Bahnhofstr. 3
> Registergericht / Local District Court: Amtsgericht Freiburg i. Br.; HRB
> Nr. / Trade register no.: 700 806
> 
> Geschäftsführer / Managing Directors: Heinz Egger, Thomas Gleixner
> 
> Eine Bitte von uns: Sollten Sie diese E-Mail irrtümlich erhalten haben,
> benachrichtigen Sie uns in diesem Falle bitte sobald wie es Ihnen
> möglich ist, durch Antwort-Mail. Vielen Dank!





More information about the elbe-devel mailing list