Search code examples
arcpy

unable to print parameters in ArcGIS and arcpy


I am beginner and created a python script tool in ArcMap and run to print input variables. I also opened python window in ArcMap. The script has not printed the variable values which entered in the tool at run time. Please suggest me.

import arcpy

fc = arcpy.GetParameterAsText(0)

dist = arcpy.GetParameterAsText(1)

print fc

print dist


Solution

  • You need to use arcpy.AddMessage(fc) rather than print(fc)

    ref: http://desktop.arcgis.com/en/arcmap/10.3/analyze/arcpy-functions/addmessage.htm