0

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>
    result3.save('C:\GEP_662\\Final_Project\\satersym')
AttributeError: 'Result' object has no attribute 'save'

Code:

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)
outputraster.save('C:\GEP_662\\Final_Project\\rastersym')

print "symbology update done"
5
  • 1
    When adding samples, remember to select the entire sample and press the {} button to give it proper formatting.
    – DWynne
    Commented May 16, 2015 at 0:42
  • @DWynne, I did select the entire sample is something missing? thanks I did not know about the {} button
    – Keri
    Commented May 16, 2015 at 0:47
  • No worries now. @dmahr made an edit for you. :)
    – DWynne
    Commented May 16, 2015 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
    Commented May 16, 2015 at 0:56
  • Problem solved, I i was not seeing anything because my path location was incorrect
    – Keri
    Commented May 16, 2015 at 2:15

1 Answer 1

2

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.

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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