Tuesday, July 5, 2011

Resetting Scripting Environmental Variables

To reset an environmental variable in ArcPy, use the ClearEnvironment().  This function will reset the environmental variable to it's default value.

Example: Setting then Clearing the Scratch Workspace

>>> import arcpy
>>> from arcpy import env
>>> env.scratchWorkspace = r"c:\temp"
>>> print env.scratchWorkspace
>>> arcpy.ClearEnvironment("scratchWorkspace")
>>> print env.scratchWorkspace

To learn more, check out the webhelp link.