BUG
** This bug has been fixed at ArcGIS 9.2 Service Pack 2. Download ArcGIS 9.2 Service Pack 2 from the link in the Related Information section below. **
As long as Python is installed properly and the Windows file associations are set properly, there should be no problems running win32com scripts from within ArcToolBox.
There is, however, a known bug that causes win32com scripts to work only once from PythonWin.
This is a known issue with version 9.2 final and 9.2 Service Pack 1. This issue has been resolved at 9.2 SP2.
Code:
# Import system modules
import sys, string, os, win32com.client
# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
gp.overwriteoutput = 1
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")
# Local variables...
cities_Buffer1_shp = "C:\\ESRI\\ESRIDATA\\CANADA\\cities_Buffer1.shp"
cities_shp = "C:\\ESRI\\ESRIDATA\\CANADA\\cities.shp"
# Process: Buffer...
gp.Buffer_analysis(cities_shp, cities_Buffer1_shp, "1 DecimalDegrees",
"FULL", "ROUND", "NONE", "")
print "done"
Code:
del gp
Code:
# Import system modules
import sys, string, os, arcgisscripting
# Create the Geoprocessor object
gp = arcgisscripting.create()
gp.overwriteoutput = 1
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")
# Local variables...
cities_Buffer1_shp = "C:\\ESRI\\ESRIDATA\\CANADA\\cities_Buffer1.shp"
cities_shp = "C:\\ESRI\\ESRIDATA\\CANADA\\cities.shp"
# Process: Buffer...
gp.Buffer_analysis(cities_shp, cities_Buffer1_shp, "1 DecimalDegrees",
"FULL", "ROUND", "NONE", "")
print "done"
Article ID:000008973
Get help from ArcGIS experts
Download the Esri Support App