Skip To Content

Scratch Workspace (Environment setting)

Tools that honor the Scratch Workspace environment setting use the specified location as the default workspace for output datasets.

The primary purpose of the Scratch Workspace environment is for use in ModelBuilder or Python.

Usage notes

  • In ArcGIS Pro, the Scratch Workspace and Current Workspace environments default to the project default geodatabase.
  • When using the tool dialog box, output dataset names are autogenerated using the Current and Scratch Workspace settings. 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 current workspace is set, the autogenerated output will be the current workspace.
    • If neither the scratch or current workspace 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 coverage workspace 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 will be used to construct the output path, regardless of whether the scratch workspace 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

ParameterExplanation

path

The default location for geoprocessing tool input and output.

scratchWorkspace syntax

Script example

import arcpy

# Set the scratchWorkspace environment to local file geodatabase
arcpy.env.scratchWorkspace = 'c:/data/scratchoutput.gdb'

Related topics