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"
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked May 16, 2015 at 0:34
5
  • 1
    When adding samples, remember to select the entire sample and press the {} button to give it proper formatting. 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 Commented May 16, 2015 at 0:47
  • No worries now. @dmahr made an edit for you. :) 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#//… Commented May 16, 2015 at 0:56
  • Problem solved, I i was not seeing anything because my path location was incorrect 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.

answered May 16, 2015 at 0:56
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.