AnsweredAssumed Answered

Arcpy GetMessages in PythonWin

Question asked by JacobHorwitz on Aug 27, 2018
Latest reply on Aug 27, 2018 by Dan_Patterson

I'm a beginner to Python coding and now working on a basic script program, where I'm using both Print and arcpy.AddMessage/arcpy.AddError in a standalone script for ArcMap or in Pythonwin. However, I'm having issues with how I can do this for arcpy.GetMessages in PythonWin to find a traceback error.


I tried using:

msgs = arcpy.GetMessages(2)
print (msgs)


But couldn't get any traceback message. Is there a code that helps show the traceback error in Pythonwin?



Full Script below:

import arcpy
from arcpy import env
from import *
arcpy.env.overwriteOutput = True
    # Sets the workspace evironment settings.
    env.workspace = "E:/College/Penn State/GEOG 485/Lesson 1/Lesson1"
    inRaster = "foxlake"
    contourInterval = 25
    baseContour = 0
    outContours = "E:/College/Penn State/GEOG 485/Lesson 1/Lesson1/ContourFoxLake.shp"
    arcpy.CheckOutExtension("Spatial"), outContours, contourInterval, baseContour)
    # Report a success message
    print "Contour creation successful!"
    arcpy.AddMessage("Contour creation successful!")
    # Report an error message
    print "Failed to create the contour."
    arcpy.AddError("Failed to create the contour.")
    # Report any error messages that the Contour tool might have generated
    msgs = arcpy.GetMessages(2)
    print (msgs)