ExecuteError: ERROR 000358: Invalid expressionFailed to execute (SelectLayerByAttribute).even if I just cut-and-paste your code.
where = "GageCode = %s" % int(row[0])
import csv, arcpy from arcpy import env from arcpy.sa import * arcpy.CheckOutExtension("Spatial") env.workspace = 'E:/Weathering_GIS/Working.gdb' try: f = open('E:/Weathering_GIS/Sheds.csv') sheds = csv.reader(f) for row in sheds: print row # this is a python list - you want the first element ([0]) arcpy.MakeFeatureLayer_management(arcpy.workspace, 'Shedpoints9') # my solution is to construct the where clause here. Note the escaped single quotes. where = "GageCode = \'%s\'" % row[0] arcpy.SelectLayerByAttribute_management("Shedpoints9","",where) except: del sheds f.close() raise
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.