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 would want to use arcpy in my python code. I am able to import it through the ARCGIS desktop python console. But I am not able to import it into Python IDLE. I get the following error

Traceback (most recent call last):

File "C:\Python26\lib\site-packages\win32com\client\", line 246, in 
__getitem__raise TypeError("This object does not support enumeration") 

I mentioned the following folders as a part of my python path.

C:\Program Files\ArcGIS\Desktop10.0\arcpy;
C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy;

I found the same issue being mentioned.

import arcpy yields "TypeError: This object does not support enumeration"

The user says it is due to the following:

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.

I have only ARCGIS 10 and i am not aware of how arcpy looks up for its modules.

share|improve this question
Are you simply typing import arcpy into the Python shell (of IDLE) to see this error? Or perhaps simply typing import arcpy into a Python window (of IDLE) and using Run Module to see it? Do you have to use a long PYTHONPATH? I just have PYTHONPATH=C:\Python26 and C:\Python26\ArcGIS10.0 as part of my PATH variable. – PolyGeo Jun 8 '12 at 5:43
yes, im just importing the module in the IDLE window.I also tried using this python interpreter in ARCGIS,imported the arpy modules. I still get the error. – Karthik Bharadwaj Jun 8 '12 at 5:56
Do you have to use a long PYTHONPATH? I just have PYTHONPATH=C:\Python26 and C:\Python26\ArcGIS10.0 as part of my PATH variable. – PolyGeo Jun 8 '12 at 6:39
windows solution -> reinstall both arcgis and python. – Aragon Jun 8 '12 at 6:59
I would like to understand how the underlying issue and how it is caused, at the worst case i think il have to uninstsall both. @PolyGeo. I changed my path and python path variable. but the issue removes the same. – Karthik Bharadwaj Jun 8 '12 at 7:06
up vote 8 down vote accepted

Fix your PYTHONPATH. From ArcGIS help:

When using an import statement, Python looks for a module matching that name in the following locations (and in the following order):

  1. Paths specified in the PYTHONPATH system environment variable
  2. A set of standard Python folders (the current folder, C:\python2x\lib, C:\python2x\Lib\site-packages, and so on)
  3. Paths specified inside any .pth file found in 1 and 2

For more information on this, see the following: The installation of ArcGIS 10.0 products will install Python 2.6 if it isn't already installed. The installation will also add the file Desktop10.pth (or Engine10.pth or Server10.pth) into python26\Lib\site-packages. The contents of this file are two lines containing the path to your system's ArcGIS installation's arcpy and bin folders. These two paths are required to import ArcPy successfully in Python version 2.6. When using an import statement, Python refers to your system's PYTHONPATH environment variable to locate module files. This variable is set to a list of directories.


If importing ArcPy produces either of the following errors, the required modules could not be found: ImportError: No module named arcpy ImportError: No module named arcgisscripting

To address this, browse using Windows Explorer to the python26\Lib\site-packages folder and add or edit the Desktop10.pth file. The file should contain the two lines shown below (corrected to your system's path if they do not match):

  • C:\Program Files\ArcGIS\Desktop10.0\arcpy
  • C:\Program Files\ArcGIS\Desktop10.0\bin
share|improve this answer
Thanks all. Like @Aragon suggested I re-installed both ARCGIS Desktop and Python. put the Desktop.pth file in place and it worked. – Karthik Bharadwaj Jun 11 '12 at 10:12

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.