Customer Service | Training | Contact Us
Welcome!
Login
Search Options   products areas display

Which products should be considered?

All Products

ArcCAD
ArcEditor
ArcExplorer
ArcGIS Engine
ArcGIS Explorer
ArcGIS Image Server
ArcGIS Mobile
ArcGIS Server
ArcIMS
ArcInfo Desktop
ArcInfo Workstation
ArcLogistics Route
ArcPad
ArcPad Application Builder
ArcReader
ArcSDE
ArcView
ArcView 3.x
ArcWeb Services APIs
ArcWeb Toolbar for ArcGIS
Atlas GIS
BusinessMap
BusinessMap Pro
GIS Portal Toolkit
Job Tracking for ArcGIS
MapIt
Maplex
MapObjects -- Java
MapObjects -- Windows
MapObjects IMS
MapObjects LT
MapStudio
Military Overlay Editor
NetEngine
PC ARC/INFO & DAK
PLTS
RouteMap
RouteMap IMS
SDE
Tracking Server

    Remember these settings for each visit More info
You are here:

Technical Article   FAQ:  Changes in List methods for Python with ArcGIS 9.3

Article ID: 34873
Software:  ArcGIS - ArcEditor 9.3, 9.3.1 ArcGIS - ArcInfo 9.3, 9.3.1 ArcGIS - ArcView 9.3, 9.3.1
Platforms:  Windows XP

Question

Changes in List methods for Python with ArcGIS 9.3

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.


 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:


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:

import arcgisscripting

gp = arcgisscripting.create(9.3)

gp.workspace = r"D:\Data"

fcS = gp.ListFeatureClasses()

for fc in fcS:
print fc


Created: 5/22/2008
Last Modified: 10/5/2009

This website's graphical display is now viewable only with W3C standards-compliant browsers, but the content is accessible to all browsers and Internet devices. View our supported browser matrix for more information on our website display.