I Keep getting this error message when i run the code below, can anyone tell me why?

Error message:

Traceback (most recent call last):
  File "C:\Python27\ArcGIS10.2\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 326, in RunScript
    exec codeObject in __main__.__dict__
  File "C:\GEP_662\Final_Project\Final_Project1.py", line 65, in <module>
AttributeError: 'Result' object has no attribute 'save'


import arcpy

rasterLayer = "C:\GEP_662\\Final_Project\\TOC_IDW1.lyr"
rasterLayerName = 'TOC_IDW_LYR'

# Apply the symbology from the symbology layer to the input layer
outputraster = arcpy.ApplySymbologyFromLayer_management(rasterLayerName, rasterLayer)

print "symbology update done"
  • 1
    When adding samples, remember to select the entire sample and press the {} button to give it proper formatting. – DWynne May 16 '15 at 0:42
  • @DWynne, I did select the entire sample is something missing? thanks I did not know about the {} button – Keri May 16 '15 at 0:47
  • No worries now. @dmahr made an edit for you. :) – DWynne May 16 '15 at 0:48
  • 2
    There are several issues here: 1) your pathnames are formatted incorrectly, 2) you are using an improper method to "save" the results, 3) both rasterLayerName and rasterLayer need to be layers. Try formatting your script following the Esri help page example: resources.arcgis.com/en/help/main/10.2/index.html#//… – Aaron May 16 '15 at 0:56
  • Problem solved, I i was not seeing anything because my path location was incorrect – Keri May 16 '15 at 2:15

Geoprocessing tools (with the exception of Spatial Analyst tools) return a Result object, which is what arcpy.ApplySymbologyFromLayer_management returns here. It doesn't have a save method. You may be getting this mixed up with a MapDocument or Layer object.

| improve this answer | |

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.