Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By : Donald Eric Pimpler, Eric Pimpler
Book Image

Programming ArcGIS with Python Cookbook, Second Edition

By: Donald Eric Pimpler, Eric Pimpler

Overview of this book

Table of Contents (22 chapters)
Programming ArcGIS with Python Cookbook Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Testing for and responding to specific error messages


All errors and warnings generate a specific error code. It is possible to check for specific error codes in your scripts and perform some type of action based on these errors. This can make your scripts even more versatile.

Getting ready

All errors and warnings generated by a geoprocessing tool contain both a six-digit code and a description. Your script can test for specific error codes and respond accordingly. You can get a listing of all the available error messages and codes in the ArcGIS for Desktop help system by navigating to Geoprocessing | Tool errors and warnings. This is illustrated in the following screenshot. All errors have a unique page that briefly describes the error by the code number:

How to do it…

Follow these steps to learn how to write code that responds to specific error codes generated by the execution of a geoprocessing tools:

  1. Open the ArcGIS for Desktop help system by navigating to Start | All Programs | ArcGIS |...