Quantcast
Channel: Forums - Python
Viewing all articles
Browse latest Browse all 2485

Get script path from ToolValidator

$
0
0
Hi All,

From inside the ToolValidator in a script tool, is there a way to determine the path of the script to which a script tool is pointing?

I'd like to set the default value of an input data file based on its relative path to the script. An acceptable alternative for me would be to detect the location of the toolbox containing the script tool. But the following return empty strings inside the ToolValidator class:

Code:

os.getcwd
sys.argv[0]
os.path.abspath(__file__)
inspect.getfile(inspect.currentframe())

Thanks!

Viewing all articles
Browse latest Browse all 2485

Trending Articles