Hello,
I am having trouble adding all values to layers symbology. If I use 'addAllValues()' by itself on one layer it works fine. However, when I create a list and do this en masse I get the following error:
Traceback (most recent call last):
File "\\PDCCITRDSGIS02\Projects_3\PGE\00129_21_Kleinfelder_VegManagement\Tools\Scripts\Make_Figure2_experimental.py", line 77, in <module>
hab_lyr.symbology.addAllValues()
File "C:\Program Files (x86)\ArcGIS\Desktop10.8\ArcPy\arcpy\_mapping.py", line 1387, in addAllValues
return convertArcObjectToPythonObject(self._arc_object.addAllValues(*gp_fixargs((), True)))
RuntimeError
An excerpt of my code is below. It is strange, because in my full code, I set a def query on hab_lyr with no problem.
for lyr in layers_list:
print "Updating Work Area and Buffer Data Sources..."
hab_lyr = arcpy.mapping.ListLayers(mxd, lyr)[0]
if hab_lyr.symbologyType == "UNIQUE_VALUES":
hab_lyr.symbology.addAllValues()
Add some print statements before the hab_lyr.symbology.addAllValues() so you know which layer is causing that error. I tried it on a couple of my datasets and it didn't throw that error so you'll have to do some more debugging to narrow the issue down.
print 'changing: {}'.format(hab_lyr.name)