I'm extremely confused. I set up a loop to select features by attribute from a list of feature classes. The script runs completely through the list doing exactly what it's supposed to do. But then I receive and invalid expression error.Messages:Selecting by COFIPSSelecting S_POL_ARSelecting S_COMMUNITY_GROUPSelecting V_P_FLD_HAZ_ARSelecting V_P_FLD_HAZ_LNSelecting V_P_HYDRAMODELFailed script FRISGeodatabasev12...Traceback (most recent call last): File "\\Ncemjfhqfs01\gtm\GIS\GTM_GIS_Tools\Scripts\FRISGeodatabase_v1.2.py", line 260, in <module> arcpy.SelectLayerByAttribute_management (featurelayer, "NEW_SELECTION", CLAUSE) File "c:\program files (x86)\arcgis\desktop10.2\arcpy\arcpy\management.py", line 6688, in SelectLayerByAttribute raise eExecuteError: ERROR 000358: Invalid expressionFailed to execute (SelectLayerByAttribute).The cod is as follows:PrelimSelectByCOFIPS = ["Database Connections\NC_FLOOD.sde\NC_FLOOD.DBO.BASE\NC_FLOOD.DBO.S_POL_AR", "Database Connections\NC_FLOOD.sde\NC_FLOOD.DBO.BASE\NC_FLOOD.DBO.S_COMMUNITY_GROUP", "Database Connections\NC_FLOOD.sde\NC_FLOOD.DBO.FLOOD\NC_FLOOD.DBO.V_P_FLD_HAZ_AR", "Database Connections\NC_FLOOD.sde\NC_FLOOD.DBO.FLOOD\NC_FLOOD.DBO.V_P_FLD_HAZ_LN", "Database Connections\NC_FLOOD.sde\NC_FLOOD.DBO.FLOOD\NC_FLOOD.DBO.V_P_HYDRAMODEL"]
# Select Features by COFIPS
arcpy.AddMessage("Selecting by COFIPS")
CLAUSE = ('{0} = {1}'.format ("CO_FIPS", COFIPS))
for feature in PrelimSelectByCOFIPS:
outfeaturename = string.join(feature.rstrip().split('.')[-1:],'.')
arcpy.AddMessage("Selecting " + outfeaturename)
featurelayer = os.path.join(FRIS_FGDB, outfeaturename + "_layer")
COFIPSfeature = os.path.join(FRIS_FGDB, outfeaturename)
arcpy.MakeFeatureLayer_management(feature, featurelayer)
arcpy.SelectLayerByAttribute_management (featurelayer, "NEW_SELECTION", CLAUSE)
arcpy.CopyFeatures_management(featurelayer, COFIPSfeature)
arcpy.Delete_management(featurelayer)I have the exact same loop set up two other times before this in the script to select by location and to clip by selected feature and neither of those give me any issue.What is going on here?