AnsweredAssumed Answered

Running a model outside of ArcGIS Pro?

Question asked by terrafirma_theo on Feb 8, 2018
Latest reply on Feb 12, 2018 by Dan_Patterson

Hi I have a ArcGIS Pro model which takes a polygon shapefile (Site_boundary_master) and spatially joins various layers to it, finally exporting the final output to an Excel spreadsheet:

All the joining layers are kept in various File Geodatabases.

 

I saved the model as 'AutomationModel' (but in the properties dialogue for it, it's called 'Model222'... wtf?) in a toolbox called 'Automation.tbx'.

Running the model from Model Builder works fine.

 

I then created a .py python file (from a blank .txt file) and wrote a script to run this model this way:

 

import arcpy

 

print ('Script started')
# import the toolbox
#
arcpy.ImportToolbox(r"C:\Automation\Automation.tbx")

 

print ('Toolbox imported')

 

#import the model
#
arcpy.Automation.Model222()
print ('Model imported')

print ('Script finished')

 

Pasting this code into the ArcGIS Pro python console, it work fine. Again.

 

However, when I edit the .py file in IDLE (ArcGIS Pro) and then run the script, it doesn't work at all:

 

Can someone help me fix this? Is it because I need to tell the script where all the input layers are stored? If so, how would I write this? I'm still a novice with python.

Thank you!

Outcomes