Hello,
I am new to Python. When I run my script from toolbox nothing happens. But when I step through it in PythonWin I get the error: AttributeError: 'list' object has no attribute 'next'
My code looks like this:
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create(9.3)
# Check out any necessary licenses
gp.CheckOutExtension("spatial")
#input workspace
inWS = gp.GetParameterAsText(0)
#output folder
outFolder = gp.GetParameterAsText(1)
#input flowdir
inFD = gp.GetParameterAsText(2)
#Set the workspace where the output folder is
gp.workspace = inWS
gp.addmessage("Input workspace")
gp.addmessage(inWS)
gp.addmessage("Output workspace")
gp.addmessage(outFolder)
gp.addmessage("flow direction")
gp.addmessage(inFD)
#Python will overwrite exsisting outputfiles
gp.overwriteoutput = 1
# Load required toolboxes...
gp.AddToolbox("C:\Program Files (x86)\ArcGIS\ArcToolBox\Toolboxes/Spatial Analyst Tools.tbx")
#Get a list of the tables in the input folder
rasList = gp.ListRasters("*", "GRID")
#Loop through the list of rasters
ras = rasList.next()
while ras:
outRaster = outFolder + "/" + ras
# Process: Flow Accumulation...
print ras
gp.FlowAccumulation_sa(inFD, outRaster, ras, "INTEGER")
# Move on to next grid in the list
ras = rasList.next()
Regards,
Esther