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

Exploring the default Python error message


By default, Python will generate an error message whenever it encounters a problem in your script. These error messages will not always be very informative to the end user who is running the script. However, it is valuable to take a look at these raw messages. In later recipes, we'll use Python error handling structures to get a cleaner look at the errors and respond as required.

Getting ready

In this recipe, we will create and run a script that intentionally contains error conditions. We will not include any geoprocessing or Python exception handling techniques in the script. We are doing this intentionally because we want you to see the error information returned by Python.

How to do it…

Follow these steps to see a raw Python error message, which is generated when an error occurs while a tool is being executed in a script:

  1. Open IDLE and create a new script.

  2. Save the script to C:\ArcpyBook\Ch11\ErrorHandling.py.

  3. Import the arcpy module:

    import arcpy
  4. Set...