2

I get this error when I run my script:

Traceback (most recent call last):
File "", line 1, in AttributeError: 'Symbology' object has no attribute 'renderer'

Script:

p = arcpy.mp.ArcGISProject("CURRENT")
m = p.listMaps('Map')[0]
l = m.listLayers('Raster1')[0]
sym = l.symbology
sym.renderer

https://pro.arcgis.com/en/pro-app/arcpy/mapping/symbology-class.htm

According to this URL's page there shouldn't be any error.

1
  • 2
    @BERA that looks like it could easily be made into an answer that I would upvote. – PolyGeo Sep 15 '19 at 20:10
1

Accourding to the help section for symbology class:

It is important to first make sure that a layer supports a renderer or colorizer and to know its type before trying to make updates to it. The built in hasattr function can be used for this purpose.

hasattr(l, 'renderer')
False

So renderer might not be supported for your raster layer.

What are you trying to do with the raster symbology? Maybe some other method is supported which you can use.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.