We are at the end of a Python script using ArcPy. We can crawl around ArcPy to get information, but is there any way to get a result object for our currently running script?

My motivation is to use existing code to process the same result object we might get from executing a separate script tool earlier in the script.

To clarify, I want this object: http://help.arcgis.com/en/arcgisdesktop/10.0/help/index.html#/Result/000v000000n7000000/

I was wishing I could get a Result object for the currently running process. Here are my notes for accessing ArcPy instead:

#Result.inputCount and Result.outputCount
outParameters = []
inParameters = []
for parameter in arcpy.GetParameterInfo:
    if parameter.direction == "Input":  #unsure of exact string

inputCount = len(inParameters)  
outputCount = len(outParameters) 

maxSeverity = arcpy.GetMaxSeverity() 

messageCount = arcpy.GetMessageCount()
  • I am not sure if I follow. Look into os.spawnv and see if its on the right path. If not can you post a bit more info?
    – theJones
    Commented Nov 2, 2011 at 18:13
  • What is the purpose of the code you posted? Why not just design your script tool(s) to output the desired results using SetParameter or SetParameterAsText?
    – blah238
    Commented Nov 4, 2011 at 4:00
  • Just mapping attributes of Result object to ArcPy object...just notes. Commented Nov 10, 2011 at 7:05

2 Answers 2


The result object isn't even constructed until the tool has finished running. You should have access to all your parameter values as variables from within the script, so there is no need for a result object.


As alluded to by blah238 in the comments, I would recommend packaging your scripts as tools in an ArcGIS toolbox, using arcpy.SetParameter()/arcpy.SetParameterAsText() in the script whose output you wish to store the path to, and then arcpy.GetParameter()/arcpy.GetParameterAsText() in the script that you use to process that output further.

The two scripts can then be combined in a ModelBuilder model with the output of the parameter of the first serving as the input for the second. (Obviously, make sure that you actually set the type of input and output parameters within the script/tool settings, once you have them loaded into a toolbox.)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.