I have a problem concerning the selection by attribute with python on arcmap.
I use this code:
import arcpy
from arcpy import env
arcpy.env.workspace= "E:\cities"
Mi=(r"E:\cities\rivers.shp")
rows = arcpy.SearchCursor(Mi,'"NAME" = \'Mississippi\'')
row = rows.next()
largeur = row.getValue("MILES")
arcpy.selectLayerByAttribute_management("rivers","New_SELECTION",'"MILES" >' + str(largeur))
And i got this error:
Traceback (most recent call last): File "E:\cities\scripts\Selection.py", line 8, in arcpy.selectLayerByAttribute_management("rivers","New_SELECTION",'"MILES"
' + str(largeur)) AttributeError: 'module' object has no attribute 'selectLayerByAttribute_management'
Échec de l’exécution de (SelectionByAttributes)
Can u help me please??
selectLayerByAttribute_management, your reference to "rivers" will need to be a layer. Therefore, it would probably be better to remove the reference to "Mi" and change your reference to a "rivers" layer by using the notationarcpy.MakeFeatureLayer_management(r"E:\cities\rivers.shp","rivers")– RyanKDalton Dec 03 '13 at 18:28