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

ArcMap

  • Home
  • Get Started
  • Map
  • Analyze
  • Manage Data
  • Tools
  • Extensions

ExecuteWarning

  • Summary
  • Code sample

Summary

The ExecuteWarning exception class is raised when a geoprocessing tool encounters a warning, and the SetSeverityLevel function has updated the severity level to 1. Setting the severity level to 1 instructs arcpy to throw the ExecuteWarning exception when a warning is encountered.

Code sample

ExecuteWarning exception example

The ExecuteWarning class is used below to specifically handle any geoprocessing tool warnings that result from DeleteFeatures.

import arcpy

try:
    # If a tool produces a warning, it will throw an exception
    arcpy.SetSeverityLevel(1)

    # Note: DeleteFeatures on a feature class will always return a warning
    arcpy.DeleteFeatures_management("c:/base/transport.gdb/roads")

except arcpy.ExecuteWarning:
    print(arcpy.GetMessages())

Related topics

  • Error handling with Python
  • ExecuteError

ArcGIS Desktop

  • Home
  • Documentation
  • Support

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

About Esri

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