I have created a script that uses Esri's arcpy site package and it functions properly in a stand-alone environment. I am now trying to integrate this script into a toolbox to be run within an open ArcMap session and I am having trouble. In integrating this script I am using the tool structure that ESRI suggests... http://goo.gl/eesrV . The script I have created has information in the 'ToolData' folder that I need to access to run the script.
How do I locate the script's directory dynamically when running it in an open ArcMap session?
In my stand-alone script I use 'os.getcwd()'; this works because it returns the proper location of the script and I then know the structure around it. Whereas when incorporated as a script in a tool box on run within an ArcMap session 'os.getcwd()' returns the directory of the map document while the toolbox, script, and tool data are located where ever the user installed them and my script can't find this structure.