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.
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:
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) != 0) and (int(service) != 1):
print "'service' not in the format of zero and ones: %s" % (service)
error = True
else:
print "'service' all good, either a zero or one: %s" % (service)
error = False
else:
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"
else:
print "\nNeeded 'Stop' or 'Start' passed through, instead this was received: " + stopORstart + "\n"
return
for x in xrange(0,len(service)): # this code manipulates the Service_List to be either zero (dont run) or one (run)
Service_List[1] = service
for x in xrange(0,len(service)): # this starts or stops the appropriate services, as defined by the services string
if int(Service_List[1]) == 1:
print Service_List[0] + " is set to " + Service_List[1] + ". Modifying this Service"
arcpy.StopStartService_ToolboxServerAdminToolkit(Server_Name, Port, Admin_User, Admin_Password, stopORstart, Service_List[0])
else:pass
print "\n---------------------------------------\nWeave Services Manipulated Successfully\n---------------------------------------\n"
else:
print "'error' == False\nlook at the WeaveModule.py script for errors"
return
Anyone know why the ImportToolbox is not working?