GetSeverityLevel (arcpy)
Zusammenfassung
Returns the severity level. The severity level is used to control how geoprocessing tools throw exceptions.
Syntax
GetSeverityLevel ()
Datentyp | Erläuterung |
Integer |
The severity level.
|
Codebeispiel
GetSeverityLevel example
Use SetSeverityLevel to force tool to throw an exception when a tool warning is encountered.
import arcpy
from arcpy import env
fc1 = 'c:/resources/resources.gdb/boundary'
fc2 = 'c:/resources/resources.gdb/boundary2'
# Set the severity level to 1 (tool warnings will throw an exception)
#
arcpy.SetSeverityLevel(1)
print 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
# through an exception.
#
arcpy.FeatureCompare_management(fc1, fc2, "OBJECTID")
except:
print arcpy.GetMessages()
Verwandte Themen
9/11/2013