[Qgis-developer] Problem using QgsFeature.attributes() instead of QgsFeature.attributeMap() in QGIS 1.9
Alexandre Neto
senhor.neto at gmail.com
Mon Mar 11 17:22:36 PDT 2013
I'm trying to adapt my plugin (multipart
split<http://plugins.qgis.org/plugins/splitmultipart/>)
to work in the master version 1.9. at some point in my code I had something
like this:
...
new_attributes = layer.pendingFields()
for j in range(new_attributes.__len__()):
if provider.defaultValue(j).isNull():
if QGis.QGIS_VERSION_INT < 10900:
new_attributes[j] = feature.attributeMap()[j]
else:
new_attributes[j] = feature.attributes()[j]
else:
new_attributes[j] = provider.defaultValue(j)
...
But when using it in 1.9 I got the following error in the line:
new_attributes[j] = feature.attributes()[j]
Traceback (most recent call last):
File "<input>", line x, in <module>
TypeError: QgsFields.__setitem__(): argument 2 has unexpected type
'QVariant'
Any advice is welcome.
Best regards,
Alexandre Neto
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20130312/c278b229/attachment.html>
More information about the Qgis-developer
mailing list