2016-10-01 12:09 GMT+02:00 Sayth Renshaw <flebber.c...@gmail.com>: > My main issue is that usually its just x in ,,, for a generator. > > But if I change the code > for meet in roots.iter("meeting"): > > to > for meet in roots("meeting"): > > Well its invalid but I need to be able to reference the node, how do I > achieve this? > > Sayth > --
Hi, i think, you identified the problem correctly in the previous mail: >> Before I created it as a generator I was able to use iter on my lxml root >> objects, now I cannot iter. It is not clear, what the previous - working - version was, but there is a difference between using built-in iteration handling (with built-in iter(...) or implicitly via "for elem in some_iterable_object: ...") and with the specialised "iter" method of root in the lxml library (which has specific functionalities). I don't have much experience with that library, but if your change was basically adding a "generator" layer around "roots", you may try to iterate over it to get its elements, which might supposedly support the method, you were using previously. e.g. (completely untested, as there is no xml underlying given in your sample) for root in roots: for meet in root.iter("meeting"): ... hth, vbr -- https://mail.python.org/mailman/listinfo/python-list