AddWarning

Zusammenfassung

Creates a geoprocessing warning message (Severity=1) that can be accessed by any of the GetMessages functions.

Syntax

AddWarning (message)
ParameterErläuterungDatentyp
message

The message to add.

String

Codebeispiel

AddWarning example

Add custom warning message to a 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.AddWarning(fc + " has no features.")		
else:
    arcpy.AddMessage(fc + " has " + str(featurecount) + " features.")

Verwandte Themen


7/10/2012