AnsweredAssumed Answered

Run Model Builder models thru Python.

Question asked by lelabach on Jun 25, 2015
Latest reply on Aug 18, 2015 by blake.terhune

i have 4 models that i created i am trying to run them thru python to get them to execute one at a time. i have two ways i want to try to do this. a. have python run the models ( to no success as of yet)

b. export each model out as a script and have a master script that calls on 4 scripts to run one after the other until all 4 have ran in sequence.

i am very new to this and would love any help.

here is what i have so far. and here are my errors


Traceback (most recent call last):

  File "F:\GIS\Python_Scripts\GLE_BIS_Silverlight_Overwrite\Archive\", line 16, in <module>


  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\", line 90, in ImportToolbox

    return import_toolbox(input_file, module_name)

  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\", line 441, in import_toolbox

    mymodule = generate_toolbox_module(toolbox, None, False, False, False, module_name, use_alt_alias)

  File "C:\Program Files (x86)\ArcGIS\Desktop10.1\arcpy\arcpy\", line 416, in generate_toolbox_module


  File "F:\GIS\Python_Scripts\GLE_BIS_Silverlight_Overwrite\GLE_BIS.tbx", line 63

    def SHP-BIS():


SyntaxError: invalid syntax




import arcpy, time, os, sys



Date = time.strftime("%m-%d-%Y", time.localtime())

Time = time.strftime ("%I:%M:%S :p",time.localtime())

LogFile = file(r"F:\GIS\Python_Scripts\Logs\GLE to BIS PROJECTION AND TRANSFER_" + Date + ".txt", 'w')

output = open(r"F:\GIS\Python_Scripts\Logs\GLE to BIS PROJECTION AND TRANSFER_" + Date + ".txt", 'w')





# Local variables:

output.write("Script Started At: " + str(Date) + " " + str(Time) + "." + "\n" + "Start Delete Process" +"\n")


# Process: Delete Temp Holding Shapefiles



     # Process: Delete Temp Holding Shapefiles

        if arcpy.DeleteTempHolding_GLE_BIS():

            output.write("Delete of Temporary files SUCCESS","\n")


    output.write("Delete of Temporary files FAIL","\n")


output.write("END OF SCRIPT","\n")


# reset date and time from when  started

lDate = time.strftime("%m-%d-%Y", time.localtime())

lTime = time.strftime("%I:%M:%S %p",time.localtime())


# write to log and close

output.write(str("GLE to BIS Script Ended at  " + str(lDate) + " " + str(lTime) + "." + "\n"))



now = time.time()


print "Script Complete"