GetSeverity

Zusammenfassung

Gets the severity code (0, 1, 2) of the specified message by index.

Syntax

GetSeverity (index)
ParameterErklärungDatentyp
index

Numeric index position of the message in the stack.

Integer
Rückgabewert
DatentypErklärung
Integer

Severity code of the message.

  • 0message
  • 1warning
  • 2error

Codebeispiel

GetSeverity example

Returns the severity code and message for each geoprocessing tool message.

import arcpy

in_featureclass = arcpy.GetParameterAsText(0)
out_featureclass = arcpy.GetParameterAsText(1)

# Run the CopyFeatures tool. If it fails, print out the
# severity and message for each message.
try:
    arcpy.CopyFeatures_management(in_featureclass, out_featureclass)
except arcpy.ExecuteError:
    for i in xrange(0, arcpy.GetMessageCount()):
        print('{0}: {1}'.format(arcpy.GetSeverity(i),
                                arcpy.GetMessage(i)))

Verwandte Themen


In diesem Thema