I have been using the following Python code on QGIS 3 (2.99) to look up fields, for several months

id = feature.attributes()[layer.pendingFields().lookupField('ID')]

And it gives me an error today:

AttributeError: 'QgsVectorLayer' object has no attribute 'pendingFields'

Is this another breaking change in the QGIS development version? And what's the correct way to write it now?

1 Answer 1


The answer seems to be yes, another change in QGIS 2.99.

I saw a question (not available) from @Andreas Neumann on the qgis-dev mailing list regarding the same question.

@Etienne Trimaille and @Alessandro Pasotti reveal that pendingFields() is removed and suggest that you instead should use fields().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.