GetSeverityLevel (arcpy)
Resumen
Returns the severity level. The severity level is used to control how geoprocessing tools throw exceptions.
Sintaxis
GetSeverityLevel ()
Tipo de datos | Explicación |
Integer |
The severity level.
|
Ejemplo de código
GetSeverityLevel example
Use SetSeverityLevel to force tool to throw an exception when a tool warning is encountered.
import arcpy
fc_1 = 'c:/resources/resources.gdb/boundary'
fc_2 = 'c:/resources/resources.gdb/boundary2'
# Set the severity level to 1 (tool warnings will throw an exception)
arcpy.SetSeverityLevel(1)
print("Severity is set to : {0}".format(arcpy.GetSeverityLevel()))
try:
# FeatureCompare returns warning messages when a miscompare is
# found. This normally would not cause an exception, however, by
# setting the severity level to 1, all tool warnings will also
# return an exception.
arcpy.FeatureCompare_management(fc_1, fc_2, "OBJECTID")
except arcpy.ExecuteWarning:
print(arcpy.GetMessages(1))
except arcpy.ExecuteError:
print(arcpy.GetMessages(2))
Temas relacionados
4/26/2014