Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

i'm recently using Python for my Processing work that I do with ArcGis 9.3. I figured out, that using Eclipse (with PyDev) could be helpfull for debugging purpose. The geoprocessor is starting as demanded.

Nevertheless i got into trouble using a Example-Script from Esri:

fcs = gp.ListFeatureClasses("block*", "Polygon")

for fc in fcs:

This causes an error:

File "C:\Python26\lib\site-packages\win32com\client\", line 228, in __getitem__
    raise TypeError, "This object does not support enumeration"

The Script works fine when starting from ArcCatalog! It seems that the variable "fcs" is of type "instance" and that python ain't able to enumerate this type.

But why doesn't ArcGIS 9.3 have a problem with this? Does anybody know this?

share|improve this question
up vote 3 down vote accepted

You can work around this using this idiom:

fcs = gp.ListFeatureClasses("block*", "Polygon")
for fc in iter(, None):
share|improve this answer
Thank you, this seems to work for eclipse. But ArcGis/ArcCatalog seems to have a problem now: <type 'exceptions.AttributeError'>: 'list' object has no attribute 'next' Failed to execute (Script). In Eclipse there is another error now in this line fcs = gp.ListFeatureClasses("block*", "Polygon") for fc in iter(, None): fieldmappings.AddTable(fc) fieldmappings.AddTable(fc) File "<COMObject <unknown>>", line 2, in AddTable If i have to fix every upcoming error with a workarround i better stick to starting scripts in ArcGis. Thanks for your Help :) Markus – Markus Jun 12 '11 at 11:58
Sorry but the Formatting seems to be lost. :( – Markus Jun 12 '11 at 12:35
This absolutely should not be happening if you're using the same code in both environments. How are you creating the geoprocessor? – Jason Scheirer Jun 12 '11 at 16:10
gp = arcgisscripting.create(9.3) – Markus Jun 15 '11 at 16:22
Yeah, that's a bug. You'll need to do some awful workaround like for fc in iter(getattr(fcs, 'next', fcs), None): – Jason Scheirer Jun 15 '11 at 16:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.