ArcGIS Desktop

  • ArcGIS Pro
  • ArcMap

  • My Profile
  • Ayuda
  • Sign Out
ArcGIS Desktop

ArcGIS Online

La plataforma de representación cartográfica para tu organización

ArcGIS Desktop

Un completo SIG profesional

ArcGIS Enterprise

SIG en tu empresa

ArcGIS Developers

Herramientas para crear aplicaciones basadas en la ubicación

ArcGIS Solutions

Plantillas de aplicaciones y mapas gratuitas para tu sector

ArcGIS Marketplace

Obtén aplicaciones y datos para tu organización.

  • Documentación
  • Soporte
Esri
  • Iniciar sesión
user
  • Mi perfil
  • Cerrar sesión

ArcMap

  • Inicio
  • Introducción
  • Cartografiar
  • Analizar
  • Administrar datos
  • Herramientas
  • Extensiones

AddIDMessage

  • Resumen
  • Debate
  • Sintaxis
  • Muestra de código

Resumen

Allows you to use system messages with a script tool.

Debate

Geoprocessing errors and warnings are returned from geoprocessing tools with a six-digit code and a text message. Every error and warning has a corresponding description page in the desktop help system. This page contains both a detailed description of the error and possible solutions for the error. In tool dialog boxes, the Python window, and the Results window, the ID code is a link that, when clicked, takes you to a description page.

Sintaxis

AddIDMessage (message_type, message_ID, {add_argument1}, {add_argument2})
ParámetroExplicaciónTipo de datos
message_type

The message type defines whether the message will be an error, warning, or informative. Valid message types are the following:

  • ERROR —Adds an error message to the tool messages
  • INFORMATIVE —Adds an informative message to the tool messages
  • WARNING —Adds a warning message to the tool messages
String
message_ID

The message ID allows you to reference existing messages for your scripting errors and warnings.

Integer
add_argument1

Depending on which message ID is used, an argument may be necessary to complete the message. Common examples include dataset or field names. Data type can be string, integer, or double.

Object
add_argument2

Depending on which message ID is used, an argument may be necessary to complete the message. Common examples include dataset or field names. Data type can be string, integer, or double.

Object

Muestra de código

AddIDMessage example

Add a message to a Python script tool.

class overwriteError(Exception):
    pass

import arcpy

in_feature_class = arcpy.GetParameterAsText(0)
out_feature_class = arcpy.GetParameterAsText(1)

try:
    # If the output feature class already exists, raise an error
    if arcpy.Exists(in_feature_class):
        # Raise a custom exception
        raise overwriteError(out_feature_class)
    else:
        arcpy.CopyFeatures_management(in_feature_class, out_feature_class)

except overwriteError as err:
    # Use message ID 12, and provide the output feature class
    #    to complete the message.
    arcpy.AddIDMessage("Error", 12, str(err))

Temas relacionados

  • AddError
  • AddMessage
  • AddReturnMessage
  • AddWarning
  • GetMessage
  • GetMessageCount
  • GetMessages
  • GetReturnCode
  • Escribir mensajes en las herramientas de secuencia de comandos
  • Comprender los tipos de mensajes y su severidad
  • Comprender mensajes en las herramientas de secuencia de comandos
  • GetIDMessage

ArcGIS Desktop

  • Inicio
  • Documentación
  • Soporte

ArcGIS

  • ArcGIS Online
  • ArcGIS Desktop
  • ArcGIS Enterprise
  • ArcGIS
  • ArcGIS Developer
  • ArcGIS Solutions
  • ArcGIS Marketplace

Acerca de Esri

  • Quiénes somos
  • Empleo
  • Blog de Esri
  • Conferencia de usuarios
  • Cumbre de desarrolladores
Esri
Díganos su opinión.
Copyright © 2021 Esri. | Privacidad | Legal