2

What do I need to do in order to get a custom arcpy script to save an execution run into the Results window, and/or just straight to an .rlt file directly?

The script is run from the command line and isn't in a toolbox.

Motivation: I use results as documentation, to see what has been done in a particular project, and to recreate particular steps dynamically at will, confident that I will get the same outcome. Significant steps are saved as .rlt for future reference and re-use in other projects. I want to capture my non-toolbox scripts as well as model scripts in this manner as well as stock tools.

Result window showing place where script run would be

PolyGeo
65.5k29 gold badges115 silver badges350 bronze badges
asked Jul 31, 2015 at 18:37
5
  • 1
    Looks like ArcPy gp tools return a result object you can save using the saveToFile method. resources.arcgis.com/en/help/main/10.2/index.html#//… Commented Jul 31, 2015 at 18:46
  • @EokN. answer is correct to save a result to a file. But the only way to get a result is to have it run as a tool. You wont/cant see a py script execution in the results window. You could wrap your script as a script tool and execute it from inside ArcGIS. That would give you a result Commented Jul 31, 2015 at 19:04
  • @EokN. True, although that would have to be done for each GP tool that is called within the script, creating separate files for each. Back to the question: Is there a reason you don't want to build your scripts into toolboxes? You wouldn't necessarily have to change the script, in fact you could write a generic toolbox to run a script with given parameters....that would 'document' that you ran it, etc. Commented Jul 31, 2015 at 19:04
  • @EvilGenius adding a script to a toolbox tedious, so I tend to avoid it unless it's something that warrants the extra work. Consequently only about a 3rd of the scripts I use end up being recorded. :-/ The idea of a generic "run this" tool is interesting. I might explore that. Commented Jul 31, 2015 at 21:43
  • this is a sub case of gis.stackexchange.com/questions/138789/… Commented Sep 10, 2015 at 17:58

1 Answer 1

0

As commented by @KHibma:

the only way to get a result is to have it run as a tool. You wont/cant see a py script execution in the results window. You could wrap your script as a script tool and execute it from inside ArcGIS. That would give you a result

answered Jan 12, 2017 at 9:19

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.