2

I am trying to update the symbology of a layer with another layer with a python script. I have written a code for this. But I am getting the following error message :

ERROR 000732: Input Layer: Dataset C:\Temp\Assessment\work\code Output does not exist or is not supported
ERROR 000968: The symbol layer does not match the input layer

Here is a part my code that is experiencing this.

# Apply symbology from a layer                                      

SymbologyLayer = arcpy.mapping.Layer("C:\Temp\Assessment\mod05AssessedEx\Shadow      Line Symbols.lyr")
Layers = arcpy.mapping.ListLayers(SymbologyLayer)

inputLayer = arcpy.MakeFeatureLayer_management(RasterIntoPolygon,"newLayer")
saveHere = r"C:\Temp\Assessment\work\code Output"
arcpy.SaveToLayerFile_management(inputLayer,saveHere)
print arcpy.Describe("C:\Temp\Assessment\mod05AssessedEx\Shadow Line Symbols.lyr")
DEMwithSymbol = arcpy.ApplySymbologyFromLayer_management(saveHere,Layers[2])    
arcpy.RefreshActiveView()
arcpy.RefreshTOC
print "Applied symbology"

Can anyone please give any suggestion???

  • You need to give the layer a name saveHere = r"C:\Temp\Assessment\work\code Output\MyLayer.lyr" otherwise the tool doesn't know what you're talking about. – Michael Stimson Jun 25 '15 at 5:20
  • I think you should review the other ERROR 000732 Q&As. – PolyGeo Jun 25 '15 at 5:48
  • 1
    You might want to have a look at the root of the other error too. Unless that RasterrIntoPolygon variable has special powers. Aside from that there are several fairly questionable sections. The one relating to the error you seem concerned with has to do with how you have concatenated a path with what I assume is meant to be a variable (output), all within quotes. Although it could be a path with spaces... which is not a great idea really. You miss out on "r" ing the path other places. \t is tab in python Http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//… – Mike Jun 27 '15 at 7:07
1

An option that has worked for me is using the data source options you have from python. This has allowed me to write a script to transfer pie chart symbology, which isn't possible for some reason with standard tools. It also lets me repair broken links where symbology gets dropped when the data source is relinked from layer properties. You can also relink broken event themes to point layers while maintaining symbology. Broken event themes are problematic because no data sourcing tools let you input coordinate fields. Something is handled differently in arcpy data source tools and these are some of the ways I have found that they can benefit you.

http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#//00s30000004p000000

The general workflow would be save out a lyr file for the layer with the symbology you want,then change the data source on the lyr file, then add the lyr to the map.

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.