<div><br></div>I'm trying to adapt my plugin (<a href="http://plugins.qgis.org/plugins/splitmultipart/">multipart split</a>) to work in the master version 1.9. at some point in my code I had something like this:<div><br>
</div><div><div>...</div><div>new_attributes = layer.pendingFields()</div><div> </div><div> for j in range(new_attributes.__len__()):</div><div> if provider.defaultValue(j).isNull():</div><div> if QGis.QGIS_VERSION_INT < 10900:</div>
<div> new_attributes[j] = feature.attributeMap()[j]</div><div> else:</div><div> new_attributes[j] = feature.attributes()[j]</div><div> else:</div><div> new_attributes[j] = provider.defaultValue(j)</div>
</div><div>...</div><div><br></div><div>But when using it in 1.9 I got the following error in the line: new_attributes[j] = feature.attributes()[j]</div><div><br></div><div><div><span style="background-color:rgb(255,255,255)">Traceback (most recent call last):</span></div>
<div><span style="background-color:rgb(255,255,255)"> File "<input>", line x, in <module></span></div><div><span style="background-color:rgb(255,255,255)">TypeError: QgsFields.__setitem__(): argument 2 has unexpected type 'QVariant'</span></div>
</div><div><span style="background-color:rgb(255,255,255)"><br></span></div><div><br></div><div>Any advice is welcome.</div><div><br></div><div>Best regards,</div><div><br></div><div>Alexandre Neto</div>