Problem using ListFeatureClasses from a personal geodatabase

279
1
11-21-2010 11:55 AM
karlkliparchuk
New Contributor
Hi. I am new to python and arcobjects.  I am trying to make a simple script that lists all the feature classes in a personal geodatabase, then do some customization to each feature class.  I keep hitting an error when I try to get the list of feature classes in the GDB (I assume that the layers in the GDB should be termed feature classes).  Here is the code snippet, plus the error message I get.  Any help is greatly appreciated.

# Import arcpy module
import arcpy, sys, os
from arcpy import env

# Local variables:
env.workspace = "C:\Data\module1data.mdb"
outputGDBpath = "C:\Data"
outputGDBname = "SS" 

         
fcs = arcpy.ListFeatureClasses ("*", "all")
fc = fcs.next()

==
I get the error message:
fc = fcs.next()
AttributeError: 'list' object has no attribute 'next'

The gdb has 4 vector feature classes within it.

Thanks.
Karl
0 Kudos
1 Reply
karlkliparchuk
New Contributor
I guess there are not many python programmers around here.  Well I kept bashing at the code.  I saw another sample code in the online help using a for loop, and did not need the fc= fcs.next () line as the while loop did.  So when I commented out the next line, and changed the while to a for loop, my program worked! 

I am GUESSING that the .next () attribute does not exist in ArcObjects after you run the
fcs = arcpy.ListFeatureClasses() statement.
0 Kudos