I have this small code to change a feature layer's symbology. I'm referencing this help doc.
When I try to change the break count I get a RuntimeError. And when I try to identify the classification field I don't seem to find it. Using a print statement, I identify other properties but not the field. The only thing i can think of is possibly because this field is set to a custom expression:


for lyr in m.listLayers():
if lyr.isFeatureLayer:
sym = lyr.symbology
if hasattr(sym, 'renderer'):
#type of renderer
if sym.renderer.type == 'GraduatedColorsRenderer':
#sym.renderer.breakCount = 4 -RuntimeError: Invalid breakCount 4
print('break count: {}\nmethod: {}\nfield: {}'.format(sym.renderer.breakCount,
sym.renderer.classificationMethod,
sym.renderer.classificationField))
prints:
break count: 5
method: ManualInterval
field: