I've written the following code based on "Writing Geoprocessing Scripts with ArcGIS" but am getting an error which I can't figure out. What is Python storing the data as (string, list, etc)? Has there been changes to how ArcGIS interprets the code?
Using Python 2.5.1; ArcGIS 9.3; Windows XP.
import arcgisscripting
GP = arcgisscripting.create(9.3)
GP.overwriteoutput = 1
GP.workspace = "C:\\USER\\FLATHER\\great_plains_corridor\\experimental"
rows = GP.SearchCursor("C:\\USER\\FLATHER\\great_plains_corridor\\experimental\\polys_dd.shp")
row = rows.reset()
row = rows.Next()
for row in rows: # just in case, the following two lines are indented in the code but didn't appear indented in the preview
print row(0)
row = rows.Next()
The error is:
Traceback (most recent call last):
File "C:\Python25\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py", line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\USER\FLATHER\great_plains_corridor\experimental\script3.py", line 23, in <module>
for row in rows:
TypeError: 'geoprocessing cursor object' object is not iterable