Better error messages from ImportToolbox

Idea created by curtvprice Champion on Aug 8, 2014
    New
    Score30
    • curtvprice
    • mpmull2u
    • phaggerty
    ImportToolbox of a Python toolbox does not provide a very useful error message ("not found") if the toolbox cannot load for me. I'm pretty sure my issue is this esri team-posted toolbox requires 64 bit. "not found" doesn't help me really - as the .pyt file does for sure exist.

         This ideas request is in response to:
         [Incident #1296183  ImportToolbox of python toolbox (pyt) fails - "not found"

    import arcpy
    pth = "h:/vic/tools/MultidimensionSupplementalTools/Multidimension Supplemental Tools.pyt"
    print(arcpy.Exists(pth))
    arcpy.ImportToolbox(pth,"mds")
         Here are the messages from running the script:
          
    True
    
    Traceback (most recent call last):
      File "H:\vic\scripts\testimporttool.py", line 14, in <module>
        arcpy.ImportToolbox(pth,"mds")
      File "C:\ArcGIS\Desktop10.2\arcpy\arcpy\__init__.py", line 124, in
    ImportToolbox
        return import_toolbox(input_file, module_name)
      File "C:\ArcGIS\Desktop10.2\arcpy\arcpy\toolbox_code.py", line 436, in
    import_toolbox
        toolbox = gp.createObject("Toolbox", tbxfile)
      File "C:\ArcGIS\Desktop10.2\arcpy\arcpy\geoprocessing\_base.py", line
    379, in createObject
        self._gp.CreateObject(*gp_fixargs(args, True)))
    IOError: The toolbox file
    h:/vic/tools/MultidimensionSupplementalTools/Multidimension Supplemental
    Tools.pyt was not found.