leoquig

Setting Target Locations for Archydro with python

Discussion created by leoquig on Dec 17, 2013
Latest reply on Nov 30, 2017 by Thomas.Taggart_NHDES
Hi there, i'm sure there is a simple answer but I haven't been able to figure it out yet.

I am trying to script some archydro processing with python. I am using the ArcHydroTools.

I am getting errors about setting the target locations so I put these lines in my code.

RasterLoc = "C:/Users/Me/Documents/Project/ScriptHydro"
VectorLoc = "C:/Users/Me/Documents/progect/ScriptHydro/xArcHydro.gdb"
ArcHydroTools.SetTargetLocations("HydroConfig","Layers",RasterLoc,VectorLoc)


I am getting the following error.

Traceback (most recent call last):
  File "C:\Users\Me\Documents\Project\ScriptMethodPart2.py", line 20, in <module>
    ArcHydroTools.SetTargetLocations("HydroConfig","Layers",RasterLoc,VectorLoc)
  File "C:\Program Files (x86)\ESRI\WaterUtils\ArcHydro\bin\ArcHydroTools.py", line 62, in SetTargetLocations
    raise e
ExecuteError: System.ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length
   at System.String.InternalSubStringWithChecks(Int32 startIndex, Int32 length, Boolean fAlwaysCopy)
   at ESRI.APWR.ArcHydroGPTools.AHSetTargetLocations.Execute(IArray paramvalues, ITrackCancel trackcancel, IGPEnvironmentManager envMgr, IGPMessages message) in C:\Builds\HydroSolutions\10.1_ArcHydro\Sources\ArcHydroTools\src\ArcHydroGPTools\AHSetTargetLocations.vb:line 434
Failed to execute (SetTargetLocations).


Does anyone know the proper way to set Target locations? I even exported model builder into python but it didn't work because I had to change it to use ArcHydroTools.

Thanks

Outcomes