In my standalone QGIS script I'm selecting a couple of polygons and want to set its value in the field 'distance' to NULL.
I checked the PyQGIS Documentation, past SE Questions and came up with the following code:
for feature in layer.selectedFeatures(): feature.setAttribute('distance', '') layer.updateFeature(feature) return layer
The selection works perfectly fine but it doesn't change the attributes. According to the docs the function setAttribute() takes the field name as first variable and than the input you like it to have.
I also tried to use None instead of ' ', but it didn't work either.
What am I doing wrong?
I'm using QGIS 3.10