I am stuck with this issue for days, and yet I could not find a solution.
Long story short, the "arcpy.ApplySymbologyFromLayer_management" simply does not work. The code runs without any issue, I can see the layer briefly locking on ArcPRO, but zero results.
aprx = arcpy.mp.ArcGISProject("CURRENT")workspace = "C:\whatever.gdb"ref_lyrx = r"C:\SimbologyIwant.lyrx"
arcpy.env.workspace = workspace
map = aprx.listMaps('Map')
layers = map.listLayers()
layers2 = map.listLayers()
I also tried
which uses the a layer file instead of a layer on the map. parameters
I refreshed, I ran the code with the map closed, added the optional p, tried all variations that I could think of. The code runs, but the symbology never changes.
Anyone has a sample code that works? Or any idea why my code has no results?
It's been a while, but I believe the information on this page may still be relevant:
So, if you're not on at least version 2.3 or if you are and this is still happening then you can try updating the connection or removing/re-inserting the layer.
I'm using 2.4.1. This topic you linked is actually on my bookmark bar, and I already tried some solutions there, including clearing the cache and updating connections. I'm still struggling with adding/copying/removing layer stuff, but hopefully will made a functional code soon. Still, the tool and syntax is pretty straightforward, I wonder why it does not work.
Update: I created a model, exported to Arcpy, added it to a toolbox and then I run it. Code runs without any results.
If I run the model on ArcGIS Pro, the symbology is updated.