I was wondering if it is possible to get the exact python code corresponding to a specific run of a tool in ArcToolbox?

The reason I ask is that I want to replicate the function in a Tool in Python, and adapt it to my needs.

I have tried some md tool for ncdf, which works in the GUI but not in python if I write the python code by hand.

  • Just to clarify, would you like the Python script of one certain tool that is found in one ArcToolbox or do you want the Python script of the whole toolbox? Which graphic user interface do you mean? Model builder? Maybe we could help you even better if you specify which tool(box) exactly you mean. – Jelle Mar 17 '15 at 16:16

After running the tool navigate to the 'Results' window, right click on the process and select "Copy As Python Snippet".

enter image description here

  • The 'Results' window can be found under the 'Geoprocessing' tab. – landocalrissian Mar 17 '15 at 18:49

You can use modelbuilder to configure your algorithm, drag & drop the tools that you need from the toolbox. Configure the inputs and outputs. And then in the model builder window export to pyhton.

enter image description here


Tools can be added to model builder and exported as a python code. Not sure this answers your question but is a technique I have often used to replicate tools in python.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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