You are here:
Automating your work with scripts
Creating script tools
This topic was updated for 9.3.1.
If your script tool runs a Python script, you should check the option to run the script in process, as shown below. This option only applies to Python scripts.
NOTE: Only scripts that create the geoprocessor object using arcgisscripting.create(), as shown below, can be run in process.
gp = arcgisscripting.create() # or arcgisscripting.create(9.3)
NOTE: Scripts that use dispatch, as shown below, will not be run in process, even if the Run Python script in process is checked.
# Import standard library modules
import win32com.client, sys, os
# Create the Geoprocessor object
gp = win32com.client.Dispatch("esriGeoprocessing.GpDispatch.1")
The in process option is available in ArcGIS 9.3. Prior to 9.3, Python scripts were run out of process. Running out of process requires that ArcGIS start another process (think of this as starting another program), which takes time, as illustrated below. When running out of process, there are also performance issues with message communication between the two processes.
At version 9.3, Python is incorporated into ArcGIS so that scripts can be run in process, removing all startup time and messaging overhead, as illustrated below.
Running in process requires that all modules loaded with the Python import directive have the necessary logic to enable them to run in process. All standard Python libraries, such as arcgisscripting, os, string, and time, have the necessary logic. However, nonstandard modules obtained from third parties may not have the necessary logic to run in-process. If you are experiencing unexplainable problems when your script runs, try unchecking the in process option and running your script again. If the problem goes away when running out of process, then there is most likely an issue with one of the modules you imported. In this case, leave the option unchecked.