Hi Enzo, I return to this old discussion because I noticed that the problem that I described still remain the same when I use Qgis 2.0. On the contrary when I use Qgis 2.1 all works fine. I didn't full understand this problem previously because I use qgis 2.0 on my works PC and and 2.1 with linux on my laptop.
Anyway I resolve the problem whit Qgis 2.0 using your tip of QgsFeatureRequest with NoGeometry flag, so the mail is just to keep track of the problem. thanks again. Luca 2013/12/21 Luca Lanteri <mesca...@gmail.com> > you are right, the code now works fine. > It was just my fault due to to the fact that I'm trying to take ones > first steps with pygis ! > > thanks for the support and sorry for the noise. > > Btw I also resolve my second problem described in the first mail. > > thanks > Luca > > 2013/12/21 Enzo Ciarmoli <enzo.ciarm...@csi.it>: > >> > nevertheless the problem remain the same: if i try to load the data > >> > from a table without geometry, values for i.attributes()[1] remain > >> > empty. > > > > Hi Luca, > > I tried your sample code and it works... I don't know what's wrong in > your > > situation... > > > > If your problem remain the same, > > I could suggest you to use QgsFeatureRequest with NoGeometry flag > > > > (see Detailed Description in: > > http://www.qgis.org/api/classQgsFeatureRequest.html ) > > > > Example: > > layer = QgsMapLayerRegistry.instance().mapLayersByName('your_table')[0] > > iter = > > > layer.getFeatures(QgsFeatureRequest().setFlags(QgsFeatureRequest.NoGeometry)) > > > > for feat in iter: > > print feat.attributes() > > print feat.attributes()[0] > > print feat.attributes()[1] > > > > > > Ciao! > > > > Enzo >
_______________________________________________ Qgis-developer mailing list Qgis-developer@lists.osgeo.org http://lists.osgeo.org/mailman/listinfo/qgis-developer