Returning individual messages with GetMessage()

While GetMessages() returns a list containing all messages from the last tool run, you can also get individual messages from the string using GetMessage().

Getting ready

Up to this point, we have been returning all messages generated by the tool. However, you can return individual messages to your user through the GetMessage() method, which takes an integer as a parameter indicating the particular message you'd like to retrieve. Each message generated by the tool is placed into a message list or array. We discussed list objects earlier in the book, so you'll remember that this is just a collection of some type of object. Just as a reminder: lists are zero-based, meaning that the first item in the ...

Get Programming ArcGIS 10.1 with Python Cookbook 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.