Hmm...I was previously establising the scratchWorkspace under the Execute defintion and I swear it was throwing syntax errors. Ok, chalk that one off to user error, I guess.
def execute(self, parameters, messages):
"""The tool logic to perform once the tool is executed."""
arcpy.env.workspace = "C:\Temp"
Works fine, except I decided look at the Scratch Workspace in the tool GUI and the value is blank. Shouldn't the value "C:\Temp" be populated in the GUI?In any case, I cant get scratchGDB to take without an error.
class Tool(object):
def __init__(self):
"""Define the tool's attributes."""
self.label = "MyTool"
self.description = "Tool1"
self.canRunInBackground = False
arcpy.env.scratchGDB = r"C:\Temp\MyGDB.gdb"
When I do that, 'MyTool' throws an error:Traceback (most recent call last): File "<string>", line 31, in __init__ File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 529, in set_ self[env] = val File "c:\program files (x86)\arcgis\desktop10.1\arcpy\arcpy\geoprocessing\_base.py", line 581, in __setitem__ ret_ = setattr(self._gp, item, value)AttributeError: Object: Environment <scratchGDB> cannot be setIt doesn't matter if I use scratchGDB at _init_, getParameterInfo, or execute, result is always the same.