Current Workspace (Environment setting)
Tools that honor the Current Workspace environment setting use the workspace specified as the default location for geoprocessing tool inputs and outputs.
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 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
- Current Workspace—The workspace from which inputs are taken and outputs are placed when running tools
Scripting syntax
arcpy.env.workspace = path
Parameter |
Explanation |
---|---|
path |
The default location for geoprocessing tool input and output. |
Script example
import arcpy
# Set the workspace environment to local file geodatabase
arcpy.env.workspace = "C:/data/base.gdb"
Related Topics
2/10/2014