Select to view content in your preferred language

Tool Validation: Noted a change ...

695
1
02-05-2010 08:12 PM
GünterDörffel
Occasional Contributor III
Hi everybody,

let me first say: Since the tool validation tab has been introduced, my script tools have become so much more user friendly ... like just asking one input from the user and the rest fills in "magically" ...

I did some test on script tolls being created in 9.3 ... they all run without any change ... I might change them but on the first hand this is very good - congrats!

There is just ONE slight change I have to make to my tool validation scripts that I would like to let you know about:

I often have in the def __init__(self): ...
#remember this is 9.3!
import arcgisscripting as ARC
import os as OS
...

and then in the def updateParameters(self):  something like ...
if self.params[3].Value:
  FilePathNeeded=OS.path.dirname(str(self.params[3].Value))

that used to work fine in 9.3 ... but in 9.4 the reference to OS is not available anymore in the updateParameters function ... can you explain?


Regards
Guenter
0 Kudos
1 Reply
JasonScheirer
Regular Contributor II
You'll want to put your import statements at the top level of your validator script and not in the __init__.
0 Kudos