I am stuck with a code due to a RunTimeError: Object: Error in Executing tool and I really can't find the mistake. The code is

# Now, the script for "Adding Surface Info" to the network, using the raster with MAX MEAN defined just above
# Set the raster of input, on the basis of the MAX MEAN
inSurface = "C:/B3061239/!!! WORK !!!/RAS_for_maxmean/", NameRasList[MEANlist.index(max(MEANlist))]
# NOTE that NameRasList[MEANlist.index(max(MEANlist)) has been calculate before
method = "BILINEAR"
if inSurface:
    print "Got inSurface"
# Create list of feature classes
fcList = arcpy.ListFeatureClasses()
print str(len(fcList))
# Process: Add Surface Information
if fcList:
    print "Got featureclasses"
    for fc in fcList:
        desc = arcpy.Describe(fc)
        print desc.name
        # Determine if the feature is 2D
        #if not desc.hasZ:
            #if desc.shapeType == "Polygon":
                # Desired properties separated by semi-colons
                #Prop = "Z_MIN;Z_MAX" 
            #elif desc.shapeType == "Point":
                #Prop = "Z"
            #elif desc.shapeType == "Multipoint":
                #Prop = "Z_MIN;Z_MAX;Z_MEAN"
            #elif desc.shapeType == "Polyline":
                #Prop = "LENGTH_3D"
            # Execute AddSurfaceInformation
    arcpy.ddd.AddSurfaceInformation(fc, inSurface, "Z_MAX", method, "", "1", "0", "NO_FILTER")
print "Completed adding surface information."
  • Can you please edit you post to use code formatting? It's very hard to read currently as a wall of text. Commented Aug 4, 2015 at 15:24
  • Is this a real path to some data : inSurface = "C:/B3061239/!!! WORK !!!/RAS_for_maxmean/"? I would certainly get rid of the spaces and "!!!" stuff. If you want a real answer for this, start by telling us ArcGIS version etc and perhaps provide the code and actual error message you are getting.
    – Neil Ayres
    Commented Aug 4, 2015 at 15:25
  • Try changing inSurface = "C:/B3061239/!!! WORK !!!/RAS_for_maxmean/" to "inSurface = r"C:/B3061239/!!! WORK !!!/RAS_for_maxmean/" The change is the raw string "r" its hard to see the change. Commented Aug 4, 2015 at 15:25
  • @TristanForward raw string is not required as the string variable does not contain any backslashes.
    – user2856
    Commented Aug 4, 2015 at 23:23
  • Can you edit your post to add the entire error traceback, not just the final error message.
    – user2856
    Commented Aug 5, 2015 at 0:11

1 Answer 1


Consider using an error handler to locate the source of the error....

    import sys, traceback

except arcpy.ExecuteError: 
    print "error"
    msgs = arcpy.GetMessages(2) 
    print msgs
    print "error"
    tb = sys.exc_info()[2]
    tbinfo = traceback.format_tb(tb)[0]
    pymsg = "PYTHON ERRORS:\nTraceback info:\n" + tbinfo + "\nError Info:\n" + str(sys.exc_info()[1])
    print pymsg + "\n"

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.