Tuesday 30 June 2015

arcgis desktop - Error 000725 message from output workspace when using Python (ArcPy) script tool?


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()


No comments:

Post a Comment

arcpy - Changing output name when exporting data driven pages to JPG?

Is there a way to save the output JPG, changing the output file name to the page name, instead of page number? I mean changing the script fo...