I am having trouble running a script tool that I just created in Arc 10.1. The script runs fine in PythonWin, but when I create a script tool with it, the tool seems to not want to accept folders or geodatabases as its output workspace. I have the output parameter (argument) set as both an output and a workspace in the script tool, but it still keeps giving me an error that the "Dataset.....already exists"
I'm a new user, so I can't post a picture, but the error is 000725
Here is my script, if that helps out.
import arcpy
#allow for overwrites
arcpy.env.overwriteOutput = True
#set the workspace
inWorkspace = arcpy.GetParameterAsText (0)
#set the erase feature
eraseFeature = arcpy.GetParameterAsText (1)
#set the output workspace
outWorkspace = arcpy.GetParameterAsText (2)
#get a list of all the features in the workspace
arcpy.env.workspace = inWorkspace
featureClassList = arcpy.ListFeatureClasses()
try:
#loop through all of the features in the workspace
for featureClass in featureClassList:
#construct the output path
outEraseFeature = outWorkspace + "\\erase_" + featureClass
#perform erase
arcpy.Erase_analysis(featureClass, eraseFeature, outEraseFeature)
arcpy.AddMessage("Wrote clipped file " + outEraseFeature + ". ")
print "Wrote clipped file " + outEraseFeature + ". "
except:
# Report if there was an error
arcpy.AddError("Could not erase feature classes")
print "Could not erase feature classes"
print arcpy.GetMessages()
Any help would be much appreciated. Thanks, in advance. Neil Loehlein Portland, OR
arcpy.env.overwriteOutput =True
– valveLondon Dec 1 '12 at 0:50