Frequently asked question

Why does Python occasionally stop responding when calling a method on the geoprocessing dispatch object?

Last Published: January 6, 2021

Answer

Note:
This article pertains to ArcGIS versions 9.x and 10.0. Later versions of ArcGIS may contain different functionality, as well as different names and locations for menus, commands and geoprocessing tools.

In many cases this issue is caused by a license conflict. Python assumes that the user has an ArcInfo license and occasionally stops responding if this is not the case. This can occur even when the user is only using tools available to their specific license.

To workaround this issue, always verify that Python knows which license being used. Do this by using the 'SetProduct' method on the dispatch object. The code snippet below provides an example.

Code:
import win32com.client
gp = win32com.client.Dispatch("esriGeoprocessing.GPDispatch.1")

gp.SetProduct("ArcView")

To verify which licenses are available use the 'CheckProduct' method on the dispatch object. The code snippet below provides an example.

Code:
import win32com.client
gp = win32com.client.Dispatch("esriGeoprocessing.GPDispatch.1")

print "ArcView license is " + gp.CheckProduct("ArcView")
print "ArcEditor license is " + gp.CheckProduct("ArcEditor")
print "ArcInfo license is " + gp.CheckProduct("ArcInfo")

Article ID:000006981

Software:
  • ArcMap 9 x

Get help from ArcGIS experts

Contact technical support

Download the Esri Support App

Go to download options

Discover more on this topic