Chapter 11. Error Handling and Troubleshooting

In this chapter, we will cover the following recipes:

  • Exploring the default Python error message
  • Adding Python exception handling structures (try/except/else)
  • Retrieving tool messages with GetMessages()
  • Filtering tool messages by the level of severity
  • Testing for and responding to specific error messages

Introduction

Various messages are returned during the execution of ArcGIS geoprocessing tools and functions. These messages can be informational in nature or indicate warning or error conditions that can result in the tool not creating the expected output or result in outright failure of the tool to be executed. These messages do not appear as message boxes. Instead, you will need to retrieve them by using ...

Get Programming ArcGIS with Python Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.