GetMaxSeverity (arcpy)
摘要
Gets the maximum severity returned from the last executed tool.
语法
GetMaxSeverity ()
数据类型 | 说明 |
Integer |
The returned severity.
|
代码实例
GetMaxSeverity example
Displays a custom message based on maximum severity of the last executed command.
import arcpy
from arcpy import env
# Set current workspace
#
env.workspace = "C:/Data/MyData.gdb"
try:
arcpy.Clip_analysis("Roads", "County", "Roads_Clip")
except:
pass
severity = arcpy.GetMaxSeverity()
if severity == 2:
# If the tool returned an error
#
print "Error occurred \n" + arcpy.GetMessages(2)
elif severity == 1:
# If the tool returned no errors, but returned a warning
#
print "Warning raised \n" + arcpy.GetMessages(1)
else:
# If the tool did not return an error or a warning
#
print arcpy.GetMessages()
相关主题
9/15/2013