Re: generator no iter - how do I call it from another function

2016-10-01 Thread Gregory Ewing
Sayth Renshaw wrote: def dataAttr(roots): """Get the root object and iter items.""" with open("output/first2.csv", 'w', newline='') as csvf: race_writer = csv.writer(csvf, delimiter=',') for meet in roots.iter("meeting"): The value of roots you're passing in here is a ge

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
> Steve > “Cheer up,” they said, “things could be worse.” So I cheered up, and sure > enough, things got worse. Loving life. I first started with a simple with open on a file, which allowed me to use code that "iter"'s. for example: for meet in root.iter("meeting"): for race in root.ite

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Steve D'Aprano
On Sat, 1 Oct 2016 06:52 pm, Sayth Renshaw wrote: > Evening > > My file list handler I have created a generator. > > Before I created it as a generator I was able to use iter on my lxml root > objects, now I cannot iter. lxml root objects have an iter method. Other objects do not. Thank you f

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Vlastimil Brom
2016-10-01 12:09 GMT+02:00 Sayth Renshaw : > 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 > achiev

Re: generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
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 -- https://mail.python.org/mailman/listinfo/

generator no iter - how do I call it from another function

2016-10-01 Thread Sayth Renshaw
Evening My file list handler I have created a generator. Before I created it as a generator I was able to use iter on my lxml root objects, now I cannot iter. ± |master U:2 ?:1 ✗| → python3 race.py data/ -e *.xml Traceback (most recent call last): File "race.py", line 83, in dataAttr(roo