import arcpy
mxd = arcpy.mapping.MapDocument ("CURRENT")
df = arcpy.mapping.ListDataFrames (mxd)[0]
lyr = arcpy.mapping.ListLayers(mxd, "Lot_Lines", df)[0]
for lyr in arcpy.mapping.ListLayers(mxd):
tlyr = lyr
dsc = arcpy.Describe(tlyr)
sel_set = dsc.fidSet
if dsc.shapeType == "Polyline":
rows = arcpy.da.SearchCursor(tlyr, "OBJECTID = " + sel_set)
for row in rows:
arcLength = row.ARCLENGTH
shapeLength = row.Shape_Length
if arcLength > 0:
print arcLength
else:
print shapeLength
del row
del rows
The error is in line 32, for row in rows: RuntimeError: An invalid SQL statement was used. I know the select Object ID works, because it changes values depending on the feature selected.