I'm creating a script tool to read the USGS earthquake GeoRSS feeds.

It works fine as a script with hardcoded values. The script also works fine as a tool for creating a new feature class for a given feed (hourly, daily, weekly possible choices).

The problem I run into is when I want to control the overwrite behavior. I want to give the user a choice: overwrite the selected feature class or append the selected feed to that feature class.

My tool has 3 parameters:

  1. Output File
  2. Feed Type: Hour, Day, Week
  3. Overwrite: Boolean

In the tool validation script, I disable the overwrite until the output file parameter selects a feature class that already exists. The problem is my script won't run because of the default behavior of the tool validation.

My question is how best to overcome this problem. I want it to default to letting the user just select a possibly existing feature class and append records to that feature class. If the user checks the now enabled overwrite parameter, then it should delete that feature class and build a new one at its location.

Even if allowing the overwrite possibility seems like bad programming practice, I'm still facing the problem of having an automated updating to the feature class, which is what I'm trying to make default: e.g., if they select the week feed to an hour feed they just ran, then it should give the entire week, including the hourly records it already possesses, without duplicating them--my script already handles this process; the validation is the problem.

I'm thinking that using arcpy.env.Overwrite in the validation might help?

1 Answer 1


What direction is your "Output File" parameter set to? Because if the output file already exists, and the parameter direction is output, the geoprocessing framework will automatically overwrite the output if the option to overwrite is set in the user's geoprocessing options, or error out otherwise, and I'm not sure you can override this in the ToolValidator.

It might be easier to use two input parameters instead; a folder (directory) and a filename (string), and then handle your overwrite logic in your script, not your validation routine. Often times this is better practice anyways since you may want to be able to run your script standalone.

  • It's set to output file, which is why I get the error. I didn't want to have my tool depend on the overwrite settings of the user because the script is designed (in standalone form) to handle that validation, defaulting to appending new feed information to the feature class. If it isn't possible, then your suggestion does appear most apt. I'm still new to this area of Python programming, so I don't always recognize the best work flow. I'll give this a try this weekend. If everything works out, you win the approved answer ;) May 3, 2012 at 22:56
  • While I still have to touch up my script (e.g., error control) and could investigate a little more on how to manage the script tool, I have a functional script. I took your advice and split the folder and file name into 2 parameters. Took awhile to figure out what data types to use since ArcGIS has horrible documentation on this!! The working script and tool can be found here: github.com/bryangoodrich/ArcGIS-API-to-USGS-Earthquake-GeoRSS May 6, 2012 at 22:43
  • 1
    Cool, glad it's working! Regarding geoprocessing data types, see this answer: gis.stackexchange.com/a/23746/753
    – blah238
    May 7, 2012 at 2:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.