<p dir="ltr">Just grab a new iterator.  Any reason you want to reuse the same iteratror.</p>
<div class="gmail_quote">On 21/10/2013 11:44 PM, "Stefano Masera" <<a href="mailto:stefano.masera@arpa.piemonte.it">stefano.masera@arpa.piemonte.it</a>> wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><span style>Hi list,</span><div style>I use an iterator two times in a python code and I have to reset it to the starting point before to recall it.</div>
<div style><br></div><div style># first use of the iterator</div><div style>iterator = layer.dataProvider().getFeatures()   </div><div style></div><div style>for feature in iterator:</div><div style><span style="white-space:pre-wrap">      </span>#  operations</div>
<div style></div><div style># than, a second time I have to use the operator, in a following part of the code:</div><div style><div>for feature in iterator:</div><div><span style="white-space:pre-wrap">      </span>#  other operations</div>
</div><div style><br></div><div style>But it doesn't start from the first feature!</div><div style></div><div style><br></div><div style>I try with:</div><div style>iterator.rewind()</div><div style><span style="font-size:12pt">between the two blocks, </span>but it doesn't work.</div>
<div style><br></div><div style>Thanks.</div><div style></div><div style></div><div style></div><div style><br><div>Stefano Masera</div></div><br></div></div><br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div>