[GIS] Pyscripter and arcpy not working together

arcgis-10.2arcpymodelbuilderpyscripter

I have installed pysripter on my machine and am not able to run any arcpy scripts from it despite being able to import arcpy. Models that work in model builder do not transition to pyscripter here is an example of an error I got

Traceback (most recent call last):
  File "S:\Shared\1 Survey Operations\Data Management\Databases\DB\Downloads\Testing\ftof.py", line 13, in <module>
    arcpy.ImportToolbox("Model Functions")
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 124, in ImportToolbox
    return import_toolbox(input_file, module_name)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\toolbox_code.py", line 438, in import_toolbox
    toolbox = gp.createObject("Toolbox", tbxfile)
  File "C:\Program Files (x86)\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line 379, in createObject
    self._gp.CreateObject(*gp_fixargs(args, True)))
IOError: The toolbox file Model Functions was not found.

Best Answer

From there error message, it looks like you are using a custom (non-standard) toolbox.

arcpy.ImportToolbox("Model Functions")

Try finding where that custom toolbox is located. Easiest way is to right click on it and select properties. Then include the full path to it in your code and include the tbx extension.

arcpy.ImportToolbox("c:\mypathtomytoolbox\Model Functions.tbx")
Related Question