I have a python script that calls a model I built in model builder. If I run the model by itself it runs perfectly. If I call the model in the python script, the model errors in various locations. Python is definitely calling the model and running some portions of it.

for GDBThatOverLaps in GDBWithDataOnInstallation:
        addMessage("Appending data from " + GDBThatOverLaps)
        inputWaterArea = GDBThatOverLaps + "\\" + WA
        inputWaterbody = GDBThatOverLaps + "\\" + WB
        arcpy.appendNHD2_rtamModels(installationBoundary, ie, inputWaterArea, targetWaterArea)
        arcpy.appendNHD2_rtamModels(installationBoundary, ie, inputWaterbody, targetWaterbody)

The model is called appendNHD2 and it is found in rtamModels toolbox which is properly imported using the add toolbox method of the arcpy module.

I have checked that all of my variables are proper paths and reference valid data.

Has anyone encountered, and overcome calling a model in python and it erroring?

  • What do you mean by "model errors in various locations"? It runs but errors in a different part of the model each time or its multiple errors consistently occurring in the same place. You don't give examples of what the errors are. If you have confirmed that the model is imported the parameters are correct then it would suggest to me that the datasets are changing in some manner that are incompatible with the model. Maybe its as simple as some annoying file lock but as don't say what the errors are then we can only speculate. – Hornbydd Sep 11 '14 at 14:06

Your Answer

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

Browse other questions tagged or ask your own question.