shps = [(shp1,"field1"),
(shp2,"field2")]
for item in shps:
shp = item[0]
field = item[1]
for row in arcpy.SearchCursor(shp, fields='"{0}"'.format(field)):
if row == MyInVariable:
sql = '"{0}" = '{1}''.format(field,MyInVariable)
if arcpy.Exists("fl"):
arcpy.Delete_management("fl")
fl = arcpy.management.MakeFeatureLayer(shp,"fl",sql)
break
del row
The above code produces an error that states: “A column was specified that does not exist.” field1 and field2 do exist as columns in shp1 and shp2 respectively. Where have I gone wrong?