Tools that honor the Scratch Workspace environment use the specified location as the default workspace for output datasets. The Scratch Workspace is intended for output data you do not want to maintain.
The primary purpose for the Scratch Workspace environment is for use in ModelBuilder or Python.
Learn more about using the current and scratch workspace environments.
Usage notes
- In ArcMap, the Scratch Workspace and Current Workspace environments are synchronized by default to the map document's default geodatabase. To learn more, see Setting the default geodatabase.
- In ArcCatalog, the Scratch Workspace and Current Workspace environments are not set by default.
- When using the tool dialog box, output dataset names are autogenerated using the Current Workspace and Scratch Workspace environments. The logic for generating the output name is as follows:
- If the Scratch Workspace environment is set, the autogenerated output path will be the scratch workspace.
- If the Scratch Workspace environment is not set, the current workspace environment is examined. If the current workspace is set, the autogenerated output will be the current workspace.
- If neither the Scratch Workspace nor the Current Workspace environment is set, the autogenerated output path will be the workspace of one of the inputs. In this case, certain restrictions apply. For example, if the workspace is a folder and the output is a new feature class, the output will be a shapefile to the directory above the coverage workspace. There are other restrictions as well, such as write access. In some cases, the output will be written to the system temp directory.
- If you enter a base name for the output dataset, the Current Workspace environment will be used to construct the output path, regardless of whether the Scratch Workspace environment is set.
Dialog syntax
- Scratch Workspace—The workspace where tool outputs will be placed if the default output name is used
Scripting syntax
arcpy.env.scratchWorkspace = path
Parameter | Explanation |
---|---|
path | The default location for geoprocessing tool input and output. |
Script example
import arcpy
# Set the scratchWorkspace environment to local file geodatabase
arcpy.env.scratchWorkspace = 'c:/data/scratchoutput.gdb'