I believe this is a super basic question but I'm not having any luck so far and I am just learning all of this. When I am running a custom tool scripted in python using the ArcCatalog, how do I read in the current workspace environment so I can use it in my script? This assumes before I run the script, I've clicked on the "Environments..." button and entered in the appropriate values for the current workspace and scratch workspace, etc. For parameters, I use something like arcpy.GetParameterAsText(0), but how do I get the environment values that were provided in the script launch window? Every example I find expects me to use something like arcpy.env.workspace = "c:/data/data.mdb", using a hard-coded path. I could create a parameter for the workspace too but it seems like I should be pulling the workspace from the configured environment. Am I going about this wrong?
Thanks
Solved! Go to Solution.
sorry, did you miss this in the arcpy tree ListEnvironments—Help | ArcGIS for Desktop there are several there such as GetSystemEnvironment—Help | ArcGIS for Desktop
You should always be setting your environments to begin with even if you think you know where they are set, this is a common area where script, models and builtin tools fail... the environments aren't known, they are in inappropriate folders or geodatabases and the lists go on. If you need a scratch workspace... make one, use it, then delete it when a script process is done and you don't need the contents. Temp is anything but...
sorry, did you miss this in the arcpy tree ListEnvironments—Help | ArcGIS for Desktop there are several there such as GetSystemEnvironment—Help | ArcGIS for Desktop
You should always be setting your environments to begin with even if you think you know where they are set, this is a common area where script, models and builtin tools fail... the environments aren't known, they are in inappropriate folders or geodatabases and the lists go on. If you need a scratch workspace... make one, use it, then delete it when a script process is done and you don't need the contents. Temp is anything but...
Thank you! Yes, I missed it and thank you for the help.