Skip to main content

GetMessages

サマリー

Returns the geoprocessing messages from a tool by a specified severity level.

構文

GetMessages({severity})

パラメーター 説明 データ タイプ

severity

Specifies the type of messages to be returned.

  • 0—Informative, warning, and error messages are returned.

  • 1—Only warning messages are returned.

  • 2—Only error messages are returned.

Not specifying a severity level will return all types of messages.

The default value is 0.

Integer

戻り値

データ タイプ 説明

String

The geoprocessing tool messages, separated by a newline ('\n').

コードのサンプル

GetMessages example

Returns the geoprocessing messages.

import arcpy

fc = arcpy.GetParameterAsText(0)
arcpy.management.GetCount(fc)

# Print all of the geoprocessing messages returned by the
#  last tool (GetCount)
print(arcpy.GetMessages())