Setting GraduatedSymbolsSymbology.classBreakValues with joined fields by ArcPy

Discussion created by cheffing on Sep 2, 2013

I tried to set breakvalues and breaklabels on a graduatedsymbol-layer. When the layer
has no join it works fine, but I need to join a SDE table in order to classify one field of the
joined table. Even if I take a field of the non-joined part of the table (e.g. AREA_HA) the script
gets an RuneTime-Error. Within the desktop application it works fine as well ...

Any ideas are welcome!

Best regards from Berlin,


import arcpy
mxd = arcpy.mapping.MapDocument(r"MJoin.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "Layer")[0]
lyr = arcpy.mapping.ListLayers(mxd, "AGHWahlkreise", df)[0]
lyrFile = arcpy.mapping.Layer(r"MJoin.lyr")
arcpy.mapping.UpdateLayer(df, lyr, lyrFile, True)
if lyr.symbologyType == "GRADUATED_COLORS":
  lyr.symbology.valueField = "AGHWahlkreise.AREA_HA"
  lyr.symbology.classBreakValues = [169.0, 503.0, 885.0, 1475.0, 2544.0, 4912.0]
  lyr.symbology.classBreakLabels = [u'169,0 - 503,0', u'503,0 - 885,0', u'885,0 - 1475,0', u'1475,0 - 2544,0', u'2544,0 - 4912,0']
arcpy.mapping.ExportToPDF(mxd, r"MJoin.pdf")
del mxd, lyrFile

Traceback (most recent call last):
  File "R:\RBS\MAP\WAHL\BW1309\Python-Code für Export\", line 9, in <module>
    lyr.symbology.classBreakValues = [169.0, 503.0, 885.0, 1475.0, 2544.0, 4912.0]
  File "C:\Programme\ArcGIS\Desktop10.1\arcpy\arcpy\arcobjects\", line 87, in _set
    return setattr(self._arc_object, attr_name, cval(val))