RudinA

Grabbing a toolbox's location for use in code or model?

Discussion created by RudinA on Mar 12, 2012
Latest reply on Mar 13, 2012 by RudinA
I have a python script that is served out to user's as a tool in our SDE.  When the script runs, it reads a table that resides in the same SDE.  Although I could hardcode the path to the table in the script, I'd much rather prefer a global solution, where the python is able to grab the workspace the tool is being housed in, and then uses that path to create a path to the corresponding table.

This would be beneficial to me because we have a development, test, and production SDE, and if the path to the table is hardcoded, then I have to update the script for each of our development tiers.  Also, I cannot always control how users name their .sde connection files in arccatalog.  it would be more foolproof if the tool could just decipher the name of the sde connection is was opened from, and push that into the code for use as a path.

Thanks for any help you can provide.

-Andrew

Outcomes