-{ a hewer of maps }-

COMfounded python

I think my python-COM environment is messed up.

Got

D:\> python list-fc.py
../Scratch/blank_canvec.gdb
<COMObject <unknown>>

and expectedsomething like this:

../Scratch/blank_canvec.gdb\ [u'counties.shp', u'roads.shp']\ counties.shp\ roads.shp

Possible culprits:

Troubleshooting

Win32 bug#3076741, "This object does not support enumeration". Using win32com.client.gencache registers com objects on the fly, fixes one problem and creates others.

update, 2011 Jan 25

I think I've narrowed it to the win32 extension, as presented by the arcgisscriptingwrapper.

I uninstalled all versions of python and cleared all directories from PATH that had any kind of python??.dll, then installed python 2.5.4, and numpy from the arcgis dvd (as per instructions here). If PYTHONPATH contains ...\ArcGIS\bin, then we get the expected results, if not, and we add arcgisscripting.py to Lib\site-packages: win32com not found. If we then install the win32com package we get the \<COMObject \<unknown>> error.

The readme for PythonWin on the install dvd says "ArcGIS no longer installs PythonWin because the recommended methodology for creating the geoprocessor has changed to using a new Python module that ESRI has developed ...".

Sooooo, arcgisscripting.py and win32com work for most things, but not for gp.ListFields() or gp.ListFeatureClasses() functions. I bet this also applies to other list functions too, see changes in list methods knowledgebase article. This means that python 2.6 and 2.7 can be used with ArcGIS 9.x, but only if you stay away from the list functions.

Retrieve members of AD group » « Don't show internal boundaries, or: Arcinfo Regions, we miss you!