This time I received the following error:Runtime error <class 'arcgisscripting.ExecuteError'>: ERROR 000358: Invalid expression Failed to execute (SelectLayerByAttribute). #Script to create distribution maps for wetland species
#Import arcpy and set workspace
import arcpy
import arcpy.mapping
arcpy.env.workspace = r"P:\CoWetlandTools\maps\distribution_maps_Johns_pytest"
import arcpy.sa
#generate a list
speciesList =("Achillea_millefolium", "Acroptilon_repens", "Actinea_osterhoutii")
#Create Loop and List to run processing for
for species in speciesList:
#select counties each species is known to occur
arcpy.SelectLayerByAttribute_management ("counties_edited_datamergetest", "NEW_SELECTION", ' " ' + species + ' " > 0')
#Export selected to jpeg
mxd = arcpy.mapping.MapDocument(r"CURRENT")
arcpy.mapping.ExportToJPEG(mxd, r"P:\CoWetlandTools\maps\' + species + '.jpg")
#clear selected attributes
arcpy.SelectLayerByAttribute_management ("counties_edited_datamergetest", "CLEAR_SELECTION")
#finished
print "Finished"
Should I be using arcpy.SelectLayerByAttribute_management ("counties_edited_datamergetest", "NEW_SELECTION", ' " ' + speciesList + ' " > 0')
instead?Never mind. Can't concatenate str and list or str and tuple objects.