Setting scratchWorkspace and scratchGDB  in a Python Toolbox

Discussion created by johnmdye on May 23, 2013
Latest reply on May 23, 2013 by johnmdye
I know that since Python Toolboxes are run in an application, they probably honor the executing application's environment settings. However, I also know if you explicitly establish an environment setting in a Python Script, such as env.scratchWorkspace, then the script is supposed to override the application's environment setting.

I need to set a scratchWorkspace and scratchGDB in a Python toolbox tool to ensure that intermediate data locations are consistent no matter which system is executing the tool, but it keeps throwing a syntax error, even though the syntax is correct. If I type the the statement into the Python Window:
import arcpy
from arcpy import env


Then intellisense brings up the scratchWorkspace and scratchGDB functions just fine.

But if I do the same in a Python Toolbox, I get a syntax error.

Are workspaces not supported programmatically in a python toolbox? Do I really have to have my users go and set it through the GUI?

You know, I dont know much in this small, cruel world, but ESRI, that ain't right. That. Just. Ain't. Right.

Disclaimer: It is highly possible that workspaces are programmatically supported in python toolboxes and I am just a bit of a moron.