Frequently asked question

Changes in List methods for Python with ArcGIS 9.3

Last Published: April 25, 2020

Answer

In ArcGIS 9.3, the Geoprocessing Programming Model changed the way List methods produced results. In ArcGIS 9.2, they were outputted as enumerations, where the properties of Next and Reset were needed to iterate through the list.

ArcGIS 9.3 now produces Python Lists that do not require Next and Reset. Below is an example of the differences.
Note:
Using Next() and Reset() with List methods produces an error only if the script uses the 9.3 version of the arcgisscripting module.
Current scripts that utilize the 9.2 version are not effected.


These changes effect the following methods:

ListFields()
ListIndexes()
ListDatasets()
ListFeatureClasses()
ListRasters()
ListTables()
ListWorkspaces()
ListEnvironments()
ListToolboxes()
ListTools()
ListInstallations()

ArcGIS 9.2 ListFeatureClasses:
Code:
import arcgisscripting
gp = arcgisscripting.create()

gp.workspace = r"D:\Data"

fcS = gp.ListFeatureClasses()
fc = fcS.Next()

while fc:
print fc
fc = fcS.Next()


ArcGIS 9.3 ListFeatureClasses:

Code:
import arcgisscripting
gp = arcgisscripting.create(9.3)

gp.workspace = r"D:\Data"

fcS = gp.ListFeatureClasses()

for fc in fcS:
print fc

Article ID:000010031

Software:
  • ArcMap 9 x

Receive notifications and find solutions for new or common issues

Get summarized answers and video solutions from our new AI chatbot.

Download the Esri Support App

Discover more on this topic

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options