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

Similar to Enumeration Problem with Eclipse and ArcGis 9.3, with Arcgis v10 I no longer seem to be able to run python scripts from a command shell. Entering the same code into an interactive python console from the same shell does work! Other scripts I have from a few months ago seem to work fine. I don't get it.

This works:

Python 2.6.6 (r266:84297, Aug 24 2010, 18:46:32) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import arcpy
>>> arcpy.env.workspace = 'd:/'
>>> print arcpy.env.workspace

Create a minimal test file:

d:\s>copy con d:\code\arcgis\
import arcpy
arcpy.env.workspace = 'd:/'
print "Workspace is: ", arcpy.env.workspace^Z
        1 file(s) copied.

and give it a spin:

d:\s>python d:\code\arcgis\
Traceback (most recent call last):
  File "d:\code\arcgis\", line 1, in <module>
    import arcpy
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\", line 17, in <module>
    from geoprocessing import gp
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\", line 14, in <module>
    from _base import *
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\", line 568, in <module>
    env = GPEnvironments(gp)
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\", line 565, in GPEnvironments
    return GPEnvironment(geoprocessor)
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\", line 521, in __init__
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\", line 523, in _refresh
    envset = (set(env for env in self._gp.listEnvironments()))
  File "C:\ESRI\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\", line 523, in <genexpr>
    envset = (set(env for env in self._gp.listEnvironments()))
  File "C:\Python26\lib\site-packages\win32com\client\", line 246, in __getitem__
    raise TypeError("This object does not support enumeration")
TypeError: This object does not support enumeration

update it's directory specific! If I copy that same file somewhere else it works.

share|improve this question
Do you have two copies of Python installed? I had weird problems associated with PythonX,Y (…) which were resolved when I installed ArcGIS 10 without the built-in python package. – Jason Feb 2 '12 at 18:13
found it @Jason, see below. – matt wilkie Feb 2 '12 at 18:36
up vote 4 down vote accepted

Aahhhh, found it! I ran afoul of keeping scripts I wrote for Arcgis 9 and 10 in the same directory. Something about the initialization logic in import arcpy finds the custom used for running python 2.6 with arcgis 9.3 when they are located together.

So as long as I keep them separated all is copacetic. I didn't run into this earlier because my other v10 scripts are part of a v10 specific project stored in a different spot.

share|improve this answer

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.