AddMessage

Zusammenfassung

Creates a geoprocessing informative message (Severity=0) that can be accessed with any of the GetMessages functions.

Syntax

AddMessage (message)
ParameterErläuterungDatentyp
message

The message to add.

String

Codebeispiel

AddMessage example

Add custom informative message to the Python script tool.

import arcpy

fc = arcpy.GetParameterAsText(0)
result = arcpy.GetCount_management(fc)

# Get the count from GetCount's Result object
#
featurecount = int(result.getOutput(0))

if featurecount == 0:
    arcpy.AddError(fc + " has no features.")		
else:
    arcpy.AddMessage(fc + " has " + str(featurecount))

Verwandte Themen


7/10/2012