wluo3340

arcpy.GetParameterAsText to get a list of numbers

Discussion created by wluo3340 on Jun 10, 2011
Latest reply on Jun 10, 2011 by curtvprice
Hi,
I'm new to python. I'd like to get a list of numbers (different flow accumulation thresholds for stream extraction) using arcpy.GetParameterAsText and then loop through the list, the relevant part of the code goes like this:

thresholdlist = arcpy.GetParameterAsText(2)
for threshold in thresholdlist:
    ...
    out_shp = out_prefix + threshold
    if not arcpy.Exists(out_shp):
        arcpy.gp.StreamToFeature_sa(strm, fdir, out_shp, "SIMPLIFY")


But when I enter
25, 35, 45
it seems it is taking one character at a time, because it create out2 and out5, then I got error
<class 'arcgisscriptin.ExecuteError'>: ERORR 000582: Error occurred during execution.

I am running ArcGIS 10 and I am running it as tool. Any suggestions/ideas? Many thanks!

Wei

Outcomes