New answers tagged model
thanks to all your good suggestions, I finally managed to get it to work. And it is so simple, really: import arcpy arcpy.env.overwriteOutput = True arcpy.env.workspace = r"c:/ArcGISdata" arcpy.ImportToolbox(r'C:\ArcGISdata\Workshop.tbx') arcpy.Workshopmodel_TestAlias() print "Script finished" So everyone: I am so gratefull. This is going to help me so ...
You've only referenced the model, not called it. In short, add () to the end of the call. So in your case: arcpy.Workshopmodel_TestAlias(). At a simple level, your model is a method, not a variable. However, this will only work if you're model doesn't have required parameters, or if all required parameters have default values (you specified values in the ...
try: import arcpy arcpy.env.overwriteOutput = True arcpy.env.workspace = r"c:/ArcGISdata" arcpy.ImportToolbox(r"c:/ArcGISdata/Workshop.tbx") #check if toolbox is imported... print arcpy.ListToolboxes('Workshop') #check if tool exist... print arcpy.ListTools('Workshopmodel') arcpy.Workshopmodel() print "Script finished"
For me, something is missing in your code. Something like the general.runalg() query should be in front of the instruction calling your model, basicly what it does is run your model after you've imported the arctoolbox. If i remember correctly you'll need to write it like this general.runalg(your model name, input data, output data)
Top 50 recent answers are included