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
c:\temp
>>> arcpy.ClearEnvironment("scratchWorkspace")
>>> print env.scratchWorkspace
None


To learn more, check out the webhelp link.

Enjoy