When I try to calculate a new field. I receive the following error:
idx = self.layer.fieldNameIndex(attributeName)
AttributeError: 'QgsVectorLayer' object has no attribute 'fieldNameIndex'
What´s the problem? I'm using QGIS 3.0.1 64x in windows.
Best Answer
in python 3: use
or
fields().indexFromName()
example: