AnsweredAssumed Answered

How to get current workspace from tool Environment?

Question asked by abrugger0219 on Aug 5, 2016
Latest reply on Aug 5, 2016 by abrugger0219

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

Outcomes