Original User: timothieb
Yes I'm a beginner Python user.
I created more or less my first script tool which simply outputs a text file describing a feature class (name, shapetype, feature count, field names, field alias, field data type and length and domain name if used).
The script was working but I discovered it was not using the output provided by the user, instead it was placing it in the same folder where the script was located (in my tests I was selecting this same location so didn't realize it was not obeying my orders until, on a whim, I changed the output location!)
In an attempt to remedy this I tried a few things - eventually a colleague pointed out that I was not actually adding the output path to the text file.
However one of the things I tried before this was to change a property of my script tool. Under the parameters tab I changed the Direction property to be 'output' instead of 'input'. When I ran the tool I got a little yellow error triangle and a message telling me that the location already existed. Of course it exists, I thought, it's an existing folder where I want the text file to be created. So I ignored the error, ran the tool, and it deleted the whole folder which had a ton of other stuff and really upset me! I was a little surprised that ArcGIS Toolbox/ Python would let me do this to myself!
Anyway I added the pathname to the output textfile, changed the parameter direction back to input and everything is working happily ....except I am a little afraid to press the buttons now!
Can anyone enlighten me as to what happened?
I have attached my scripts - in case anyone want to take a peek. Apart from the pathname issue the other small change is that originally I was taking the user input to set the workspace environment. Now I am just taking the user input as a folder path and not setting the workspace environment at all. Don't know if this has any relevance - I am assuming not?
Finally if anyone has any suggestions to improve my script I'd be happy to hear them.