I was playing around, testing the iterative and looping features of Model Builder in 10.5, to see if they were now complete enough and easier for me to understand than looping in python. I made a little model that selects a few rasters with a wildcard out of a workspace with Iterate Rasters and then changes the projection, writing the output to a new folder and using the %Name% variable to create similar names on the output files. I got the model to run, then I exported to python to see how the iteration was handled by the export. Well, the python script doesn't contain any of the iteration stuff. I thought it might run one time but it doesn't. Seems like the export to python inserted a couple lines
# Load required toolboxes
arcpy.ImportToolbox("Model Functions")<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>But at run time, IDLE doesn't know the path to this toolbox. Where do I find it?
Traceback (most recent call last): File "G:\elevation\lidar2010\Orthophotos\testiterativemodels\iterateRaster.py", line 14, in <module> arcpy.ImportToolbox("Model Functions") File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\__init__.py", line 125, in ImportToolbox return import_toolbox(input_file, module_name) File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\toolbox_code.py", line 452, in import_toolbox toolbox = gp.createObject("Toolbox", tbxfile) File "C:\Program Files (x86)\ArcGIS\Desktop10.5\ArcPy\arcpy\geoprocessing\_base.py", line 381, in createObject self._gp.CreateObject(*gp_fixargs(args, True)))IOError: The toolbox file Model Functions was not found.
<SPAN class="line-numbers-rows"><SPAN></SPAN><SPAN></SPAN></SPAN>