I am trying to add a new column to the attribute table and populate the column with a string, using the python console in QGIS. I have done the same but populating the column with an integer (FIELD_TYPE=1), which works fine, but as soon as I change the column to a string (FIELD_TYPE=2), it no longer works. The code I am trying to run:
out3 = "%s\\roth_vh_%s_3.shp"%(shpPath,year) processing.runalg('qgis:fieldcalculator',\ out2,\ "polar",\ 2,\ 4,\ 0,\ True,\ 'vh',\ out3)
The error message I get is "Evaluation error: Column 'vh' not found". So for some reason it is looking for a column vh rather than taking it as the string to populate all the fields in the column with. It's confusing me though, because if I open the attribute table and run a field calculation to populate a column with a string, I would simply select the column, type the string into the field calculation bar (e.g. 'vh') and click update all, and it would work. Any ideas why the field calculation of 'vh' is not working in pyqgis please?