Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I've created a script tool that has an optional output parameter of an Excel Workbook. If it's populated, the script will add a new worksheet. However, every time the tool is run, ArcGIS is somehow deleting the existing workbook.

I've tested it, and this happens even with a script that does nothing but pass and with a validation class that only bypasses the warning that output file already exists (self.params[0].clearMessage()).

I could optionally set it as an input parameter, but I don't want to require that the file already exists. My script will create the workbook if it doesn't already exist.

I simply want the path/name of a workbook that may or may not already exist and to which the user would like to add a worksheet.

The parameter's "direction" property is read-only, so I can't even use some convoluted logic in the validation class to change the direction of a parameter.

Is there some way to set a directionless parameter?


An example script with which this happens:

pass

Yes, that's all of it. One word; 4 letters.

As I tried to explain before, the script hasn't even started to execute when Esri--somewhere behind the scenes--deletes any datasets that are set as output parameters.

The issue is with Esri's script tool, not with the script itself.

share|improve this question
    
Have you tried preventing it from deleting your existing workbook? Is it a DEFile datatype? This might make a good question: How do I prevent Arcpy from defiling my DEFile? – Kirk Kuykendall Jun 23 at 21:41
    
@KirkKuykendall, What could I try to prevent it from deleting my workbook? That's my original question. Yes, it is a file on disk, but I'm working with a script tool, not ArcObjects, so the DEFile class is not really relevant at this level. Yes, behind the scenes, Arc is instantiating that class, but I have no control over that from a script tool. Like I said, it's deleted before it ever starts executing the script itself. – Tom Jun 23 at 22:00
    
Could you include a code snippet? – Midavalo Jun 27 at 8:12
    
@Midavalo, see the updates to the post. – Tom Jun 27 at 14:44
    
The code snippet that I think we need to see is the code for a test Python script tool which illustrates this. – PolyGeo Oct 29 at 10:29

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.