crsouder

Error importing arcpy module

Discussion created by crsouder on May 4, 2011
Latest reply on Jan 17, 2012 by emerickr
I recently upgraded to ArcGIS 10, and yesterday I went to write my first new python script since upgrading. It has been nothing but a frustration since. I quickly found the new way of accessing the geoprocessing tools was through importing the new arcpy module, but this fails ever time. My first attempt resulted in the error 'ImportError: No module named win32com.client', which I understood easy enough. I just needed to install the win32com package. I downloaded and installed the newest package, but that only changed the error message to the following:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\__init__.py", line 17, i
n <module>
    from geoprocessing import gp
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\__init__.p
y", line 14, in <module>
    from _base import *
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py",
line 568, in <module>
    env = GPEnvironments(gp)
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py",
line 565, in GPEnvironments
    return GPEnvironment(geoprocessor)
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py",
line 521, in __init__
    self._refresh()
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py",
line 523, in _refresh
    envset = (set(env for env in self._gp.listEnvironments()))
  File "C:\Program Files\ArcGIS\Desktop10.0\arcpy\arcpy\geoprocessing\_base.py",
line 523, in <genexpr>
    envset = (set(env for env in self._gp.listEnvironments()))
  File "C:\Python26\ArcGIS10.0\lib\site-packages\win32com\client\dynamic.py", li
ne 241, in __getitem__
    raise TypeError("This object does not support enumeration")
TypeError: This object does not support enumeration


Since then I have completely uninstalled and reinstalled python and the win32com packages. I have tried different versions of python 2.6 and different builds of the win32com package. Today I even went so far as to completely uninstall python, win32com, and ArcGIS and reinstalled all of them from the ArcGIS installation media. None of this has fixed my issue of importing the arcpy module.

Thanks for your time, and I hope this can be solved!

Casey Souder

Outcomes