Quantcast
Channel: Question and Answer » arcpy
Viewing all articles
Browse latest Browse all 767

Unknown Error? – A Column was specified that does not exist

$
0
0
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?


Viewing all articles
Browse latest Browse all 767

Trending Articles