2

I have a custom model (called TOOLNAME) in a custom toolbox developed in Model Builder on ArcGIS 10.1 Desktop. The model takes two input parameters (SingleFDI_D and dayindex) and outputs a Derived parameter called "MaxFDI_DateTime" which is data of String type.

enter image description here

The model runs well within the ModelBuilder on ArcGIS Desktop. It returns the result MaxFDI_DateTeime: 22/11/2017 12:00:00 AM as below.

enter image description here

I will need to run the model in Python.

How do I get the output of MaxFDI_DateTime out of the tool execution in Python?

arcpy.ImportToolbox(TOOL_DIR)
# The custom model should return a String, how to retrieve it here?
model_result = arcpy.{TOOLNAME}_{TOOLBOX_ALIAS}(SingleFDI_D, str(day))
PolyGeo
65.5k29 gold badges115 silver badges349 bronze badges
asked Nov 22, 2017 at 5:19

1 Answer 1

1

In your code snippet model_result is a Result object.

Without testing I think the string you are after can be printed from that using:

print(model_result.getOutput(0))

or

print(model_result[0])
answered Nov 22, 2017 at 5:59
2
  • Thanks! If the code snippet has multiple (i) output params, we could potentially use model_result.getOutput(i-1)? Commented Nov 23, 2017 at 0:28
  • That's what I would try. Commented Nov 23, 2017 at 1:02

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.