I have a related issue. I have written many ArcGIS specific Python scripts that run fine in IDLE/PythonWin, producing the results expected and putting them in the correct place within my file structure.
However, when I try to add the script to a toolbox as a script tool, I don't have the same success. I usually include iteration in the script (invoking the geoprocessor object as a 9.3 object to use the more pythonic for-loop structure, usually, though I explored using the 9.0-9.2 versions and the while-next structure) to perform the same operation on all feature classes within a feature dataset. The script will run 'successfully', according to the output, and yet, nothing happens.
For instance, I might Clip all the feature classes in the dataset. I'll set the workspace to the feature dataset, and have the operation run and place all the output feature classes listed in that dataset (using gp.listfeatureclasses) in another feature dataset. While again, this works fine in IDLE/PythonWin, it will not run if invoked as a script tool. The basic operation, the Clip, will work if performed (as a script tool) on a single feature class (i.e. no iteration).
Here is an example of the code, and again, it works just fine from a stand alone editor:
import sys, string, os, arcgisscripting
gp = arcgisscripting.create(9.3)
gp.overwriteoutput =1
# Load required toolboxes...
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Data Management Tools.tbx")
gp.AddToolbox("C:/Program Files/ArcGIS/ArcToolbox/Toolboxes/Analysis Tools.tbx")
workspace = 'C:/Example.gdb/FeatureDataset/'
clippedPath = 'C:/Example.gdb/OutputDataset/'
clipfeature = 'C:/Example.gdb/Clip_feature_class'
gp.workspace = workspace
featureClasses = gp.listfeatureclasses()
for feature in featureClasses:
gp.Clip_analysis(feature, clipfeature,clippedPath +feature+'_clip' , "")
Why won't this work as a script tool?