1

I am working on applying symbology to multiple layers from lyr files for multiple MXDs within the IDE. I have been able to access the MXDs and iterate through and change the definition of "mxd". I am receiving the following error, however, when the ApplySymbologyFromLayer_management process is run:

ERROR 000732: Input Layer: Dataset FCname does not exist or is not supported

My script is as follows:

# the MXDs to change, accessed and processed individually as 'i' is script not shown
mxd = arcpy.mapping.MapDocument(r'C:\Path\to\mxd\doc.mxd')
for lyr in arcpy.mapping.ListLayers(mxd):
    if lyr.name == 'FCname':
        arcpy.ApplySymbologyFromLayer_management(
            in_layer="FCname",
            in_symbology_layer="C:\Path\to\lyrs\FCname.lyr")

I have repeated the same ApplySymbologyFromLayer_management tool within ArcMap successfully. Any ideas on why this process is not succeeding within my script?

1

You want to execute your code in Standalone.So you can't use input layer name, just use layer without any properties like name,... . save your mxd after the symbology changes. You can save the current mxd or save to another mxd file (Save a Copy).

# the MXDs to change, accessed and processed individually as 'i' is script not shown
import arcpy
mxd = arcpy.mapping.MapDocument(r'C:\Path\to\mxd\doc.mxd')
for lyr in arcpy.mapping.ListLayers(mxd,"FCname"):
        arcpy.ApplySymbologyFromLayer_management(lyr,r"C:\Path\to\lyrs\FCname.lyr")
        mxd.saveACopy("C:/MychangeSymbology.mxd")
  • That did it. Thanks. I used the term IDE because I saw it here and thought it applied. Does it not? Would question be improved by changing IDE to Standalone? – reevesii Nov 14 '17 at 19:05
  • IDE and standalone words are keywords you can use their to improve your question and help others – BBG_GIS Nov 14 '17 at 19:08

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.