I have a list with the field names and I am getting the values from the vector layer
shp = "D:\file.shp" from osgeo import osr,ogr, gdal driver = ogr.GetDriverByName('ESRI Shapefile') dataSource = driver.Open(shp,0) layer=dataSource.GetLayer() list=['field1','field2','field3']
I am getting the follow error if I am doing it in the list
ValList = [feature.GetField(j) for j in list] raise ValueError("Illegal field requested in GetField()") ValueError: Illegal field requested in GetField()
So what I have to do if I want to get the values in the list?