AnsweredAssumed Answered

Script IOError, toolkit not found - im stumped!

Question asked by ben_vk on Mar 5, 2015
Latest reply on Mar 5, 2015 by ben_vk

Hi All,


I have a py script that calls a function from another py script, and I am getting the below error:

IOError: The toolbox file C:\Users\benva\AppData\Roaming\Esri\Desktop10.3\ArcCatalog\GISADMIN@SDE_Spatial@Smithy.sde\SDE_SPATIAL.GISADMIN.ToolboxServerAdminToolkit was not found.


I am unsure why the below sequence is occurring, I am completely stuck and unsure how to resolve.

2015-03-06_08-48-05_2015-03-06_08-33-55_Inbox - Microsoft Outlook.jpg - IrfanView (Zoom 1900 x 960).jpg


I have double and even triple checked this directory, and the toolkit most definitely resides in this location, please see evidence of this in the below screen grab:

2015-03-06_08-38-08_ArcCatalog - CUsersbenvaAppDataRoamingESRIDesktop10.3ArcCatalogGISADMIN.jpg


Here is the code of the function throwing the error: - specifically line 4, arcpy.ImportToolbox()

def stopStart(stopORstart,service): # set service to be '11111' to stop them all.
    import arcpy
    # Load required toolboxes
    arcpy.ImportToolbox(r"Database Connections\GISADMIN@SDE_Spatial@Smithy.sde\SDE_SPATIAL.GISADMIN.ToolboxServerAdminToolkit")
    # List of services to stop/start
    Service_List = [["Weave_Main.MapServer",1], ["Weave_Alternate.MapServer",1], ["Weave_Inset.MapServer",1], ["Weave_External.MapServer",1], ["Weave_WSData_Sheets.MapServer",1]]
    # Local variables:
    Server_Name = "gisserver"
    Port = "6080"
    Admin_User = "gisadmin"
    Admin_Password = 
    error = False
    if len(service) == len(Service_List): # this loop is for checking of the input 'service' It needs to conform to the format of 5 digits (zeros or ones) to run correctly
        for x in xrange(0,len(service)):
            if (int(service[x]) != 0) and (int(service[x]) != 1):
                print "'service' not in the format of zero and ones: %s" % (service[x])
                error = True
                print "'service' all good, either a zero or one:  %s" % (service[x])
                error = False
        error = True
        print "Error in 'service' length: %s\nShould be == : %s" % (len(service),len(Service_List))

    if error == False: # error checking, this wont run unless the above test completes
        if stopORstart.title() == "Stop":
            print "\nStopping Weave Services...\n"
        elif stopORstart.title() == "Start":
            print "\nStarting Weave Services...\n"
            print "\nNeeded 'Stop' or 'Start' passed through, instead this was received: " + stopORstart + "\n"

        for x in xrange(0,len(service)): # this code manipulates the Service_List to be either zero (dont run) or one (run)
            Service_List[x][1] = service[x]

        for x in xrange(0,len(service)):  # this starts or stops the appropriate services, as defined by the services string
            if int(Service_List[x][1]) == 1:
                print Service_List[x][0] + " is set to " + Service_List[x][1] + ". Modifying this Service"
                arcpy.StopStartService_ToolboxServerAdminToolkit(Server_Name, Port, Admin_User, Admin_Password, stopORstart, Service_List[x][0])

        print "\n---------------------------------------\nWeave Services Manipulated Successfully\n---------------------------------------\n"
        print "'error' == False\nlook at the script for errors"



Anyone know why the ImportToolbox is not working?