arcgis python 异常处理
import arcpy in_features = "c:/base/transport.gdb/roads" try: # Note: CopyFeatures will always fail if the input and output are # the same feature class arcpy.CopyFeatures_management(in_features, in_features) except arcpy.ExecuteError: print arcpy.GetMessages() ================== import arcpy try: # If a tool produces a warning, it will throw an exception arcpy.SetSeverityLevel(1) # Note: DeleteFeatures on a feature class will always return a warning arcpy.DeleteFeatures_management("c:/base/transport.gdb/roads") except arcpy.ExecuteWarning: print arcpy.GetMessages() try-except 语句 try-except