<div dir="ltr">We removed the select() method in the new version to make way for multithreading in the future. <div><br></div><div style>You can translate you code into this:</div><div style><br></div><div style>for feature in <span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">lnk_shp.getFeatures():</span></div>

<div style><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">    for attr in feature.attributes():</span></div><div style><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">      </span><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px">attr_list.append(attr.toString())</span></div>

</div><div class="gmail_extra"><br><br><div class="gmail_quote">On Wed, May 22, 2013 at 9:18 AM, Carles Boïls Gisbert <span dir="ltr"><<a href="mailto:fainssix@gmail.com" target="_blank">fainssix@gmail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi everyone,<br><br></div>I am using QGIS 1.9 Master in Ubuntu 12.10. I am trying to develop a plugin and need to extract data from attributes tables of the .shp.<br>

<br></div>I created a GUI for the user can Open shp from the computer and the code recognize the shp file and I can get the name of the .shp, name of columns, etc. but I can not get the values for each row and work with them.<br>


<br>I follow the cookbook but when I type "provider.select(allAttrs)" the python console in QGIS says:<br><br>"AttributeError:QgsVectorDataProvider' object has no attribute 'select' <br><br></div>


here is the code I used: (i didn't copy the definition of GUI because  with that is any prolem)<br><div><br><div>from PyQt4 import QtGui, QtCore<br>from PyQt4 import *<br>from qgis.core import *<br>from PyQt4.QtCore import *<br>


from PyQt4.QtGui import *<br><br>import qgis.utils, sys<br># supply path to where is your qgis installed<br>QgsApplication.setPrefixPath("/usr/", True)<br>#load providers<br>QgsApplication.initQgis()<br><br>*******<br>


      <br>        self.ln_lnk.setText(str(self.filename_lnk))<br>        <br>        lnk_shp = QgsVectorLayer(self.filename_lnk, 'casires', 'ogr')<br>        <br>        if not lnk_shp.isValid():<br>            print "doesnt work"<br>


            QtGui.QMessageBox.Warning(self, "Warning", "shp not valid", QtGui.QMessageBox.Ok)<br>        <br>        try:<br>            provider = lnk_shp.dataProvider()<br>            feat = QgsFeature()<br>


            allAttrs = provider.attributeIndexes()<br>            <br>            <br>            provider.select(allAttrs)<br>            attr_list =[]<br>            <br>            <br>            while provider.nextFeature(feat):<br>


                    <br>                attrs = feat.attributeMap()<br>                for(k,attr) in attrs.iteritems():<br>                    attr_list.append(attr.toString())<br>                    <br>        except:<br>


            self.ln_save.setText("Falsch")<br><br><br></div><div>I try the same plugin in a oldest version of QGIS 1.7.5 and it works or at least doesn't show this "Falsch". I am wondering during a  week and have no idea to sole this. I would really apreciate if someone can solve this problem because is really important to create this plugin and for tha I need to take the data from the attribute table, if not I can not continuous anymore.<br>


<br>Does anyone what is wrong and why my QGIS doesnt recognize the provider.select(allAttrs)?<br></div><div>I would like to know if somebody knows how to install a oldest version of QGIS (e.g. 1.7.5)??<br><br></div><div>

thank you so much!!<br>
</div></div></div>
<br>_______________________________________________<br>
Qgis-developer mailing list<br>
<a href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-developer" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a><br>
<br></blockquote></div><br></div>