[Qgis-user] Retrieving features iterator in python, qgis 2.10

Alexandros Avdis a.avdis at imperial.ac.uk
Fri Jul 31 09:50:56 PDT 2015


Hello,

I have, with pre - 2.10 qgis versions on Ubuntu 14.04.2 LTS, used the
following code to access shapefile features:

import qgis.core
qgis.core.QgsApplication.setPrefixPath('/usr',True)
qgis.core.QgsApplication.initQgis()
print qgis.core.QGis.QGIS_VERSION
layer = qgis.core.QgsVectorLayer("test.shp","test","ogr")
print layer.isValid()
featuresIter = layer.getFeatures()


For example, running with qgis 2.8.2-Wien I get:

$ python testQgis.py
2.8.2-Wien
True

However, running with 2.10.1-Pisa, I get:

$ python testQgis.py
2.10.1-Pisa
Segmentation fault

Has something in the API changed? Any help will be much appreciated.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150731/bed3f760/attachment.html>


More information about the Qgis-user mailing list