Select to view content in your preferred language

Problem importing ArcHydro toolbox

2994
2
05-13-2013 08:04 AM
Labels (1)
JacobCoble
Emerging Contributor
I have a question regarding the proper use of the ImportToolbox command.
We're trying to import the ArcHydro toolbox in Python, but the script stops at the arcpy.ImportToolbox command.
Here's what we have:

# Load required toolboxes
arcpy.ImportToolbox("W:\Program Files\ArcGIS\Desktop10.0\ArcToolbox\Toolboxes\Arc Hydro Tools.tbx", "archydrotools")

We've tried using "archydro" and "ArcHydroTools" as aliases to no effect.
We thought the spaces in the toolbox name might be causing the problem, so we copied the toolbox to a local drive, renamed it without spaces, but still no luck at importing the toolbox.

Thanks for any help you can provide!
Tags (2)
0 Kudos
2 Replies
V_StuartFoote
MVP Frequent Contributor
Jacob,

Check that there is a ArcHydroTools.pth recorded in the PYTHONHOME location, e.g. C:\Python27\ArcGIS10.1\Lib\site-packages

It should point to the location of the installed ArcHydroTools, e.g.  C:\Program Files (x86)\ESRI\WaterUtils\ArcHydro\bin


With that present and ArcHydroTools installed, should only need to "import ArcHydroTools"

Here is a simple command line example, it dumps the "help" for all modules.
>>>import ArcHydroTools
help(ArcHydroTools)

I've captured and attached the output of that as a ZIP'd text file ArcHydroPythonHelp.txt which should be of help for using the ArcHydroTools in Python scripting.

ArcHydroTools use in scripts will have syntax and file format requirements, NO ShapeFiles! And you will need to import your Desktop seat license level including Spatial Analyst extension, and also import the arcpy site library.

Stuart
0 Kudos
JacobCoble
Emerging Contributor
Thanks so much for the helpful advice. There was a problem with the ArcHydroTools.pth file: it was pointing to the wrong drive.

For anyone else with this same sort of problem: after importing ArcHydroTools, you can call tools with, for example, "ArcHydroTools.BuildWalls" rather than "arcpy.Buildwalls_archydro".
0 Kudos