ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Help
  • Sign Out
ArcGIS Desktop

ArcGIS Online

The mapping platform for your organization

ArcGIS Desktop

A complete professional GIS

ArcGIS Enterprise

GIS in your enterprise

ArcGIS for Developers

Tools to build location-aware apps

ArcGIS Solutions

Free template maps and apps for your industry

ArcGIS Marketplace

Get apps and data for your organization

  • Documentation
  • Support
Esri
  • Sign In
user
  • My Profile
  • Sign Out

Help

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • More...

GetSeverity

  • Summary
  • Syntax
  • Code sample

Summary

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

Syntax

GetSeverity (index)
ParameterExplanationData Type
index

Numeric index position of the message in the stack.

Integer

Return Value

Data TypeExplanation
Integer

Severity code of the message.

  • 0 —message
  • 1 —warning
  • 2 —error

Code sample

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)))

Related topics

  • GetMaxSeverity

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS Platform

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS for Developers
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

  • About Us
  • Careers
  • Esri Blog
  • User Conference
  • Developer Summit
Esri
Tell us what you think.
Copyright © 2019 Esri. | Privacy | Legal