ExecuteWarning
摘要
The ExecuteWarning exception class is raised when a geoprocessing tool encounters a warning, and the SetSeverityLevel function has updated the severity level to 1. Setting the severity level to 1 instructs arcpy to throw the ExecuteWarning execption when a warning is encountered.
代码示例
ExecuteWarning exception example
The ExecuteWarning class is used below to specifically handle any geoprocessing tool warnings that result from DeleteFeatures.
import arcpy try: # If a tool produces a warning, it will throw an exception # arcpy.SetSeverityLevel(1) # DeleteFeatures on a feature class will always return a warning # arcpy.DeleteFeatures_management("c:/base/transport.gdb/roads") except arcpy.ExecuteWarning: print arcpy.GetMessages()
相关主题
7/10/2012