Skip To Content

GetMessages

Resumen

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

Sintaxis

GetMessages ({severity})
ParámetroExplicaciónTipo de datos
severity

Specifies the severity level of messages to return.

  • 0Messages returned.
  • 1Warning messages returned.
  • 2Error messages returned.

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

(El valor predeterminado es 0)

Integer
Valor de retorno
Tipo de datosExplicación
String

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

Muestra de código

GetMessages example

Returns the geoprocessing messages.

import arcpy

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

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

Temas relacionados