jcscott

Not seeing tool in Imported Toolbox

Discussion created by jcscott on Mar 14, 2014
Hi,

I am having troubles with something related to the importing and usage of a custom toolbox in an arcpy script.

I have created a set of script tools and have saved/created them in a custom toolbox. My problem is that when i try to run a "Master Script" which imports the tools and then calls the individual tools, i recieved the error "Object: tool or environment <> not found"

Has anyone else run into this issue?

I have also tried loading the tools into a simple model builder interface, but i am unable to use the outputs from one tool in another... is this something with my script or is it a bigger problem?

Edit: I should also mention that i can see the tool if i loop through with arcpy.ListTools

Here is the master script:

import arcview
import arcpy

def main():
    try:
        toolboxpth = r'I:\Cody\Projects\All Pipes\Infowater_Tools.tbx'
        arcpy.ImportToolbox(toolboxpth)
##
        OldPipes = arcpy.GetParameterAsText(0)
        NewPipes = arcpy.GetParameterAsText(1)
        WorkingFolder = arcpy.GetParameterAsText(2)

        City = "Waterloo"
        Model_Feature = "Pipe"


        Workspace = arcpy.CreateWorkspace_IWT(City,WorkingFolder)



        arcpy.fieldRemap_IWT(City,Model_Feature,OldPipes,NewPipes,Workspace,WorkingFolder)
    except Exception as e:
        print e.message
        arcpy.AddError(e.message)

if __name__ == '__main__':
    main()


Here is one of the sub-scripts:

def main():
    try:
        city = arcpy.GetParameterAsText(0)
        folder = arcpy.GetParameterAsText(1)

        today = str(datetime.date.today())
        today = today.replace("-","")

        outputN = ("{0}_{1}".format(city,today))

        if arcpy.Exists(os.path.join(folder,(outputN + ".gdb"))):
            arcpy.AddError("Geodatabase {0} already exists".format(os.path.join(folder,(outputN + ".gdb"))))
        else:
            gdb = arcpy.CreateFileGDB_management(folder,outputN)[0]
            arcpy.SetParameter(2,gdb)

    except Exception as e:
        print e.message
        arcpy.AddError(e.message)

if __name__ == '__main__':
    main()

Outcomes