I am running some ArcPy scripts and the tools keep wanting to write to my c:\users\appdata\local\temp location. I have set the scratchworkspace and workspace environment variables of arcpy to a drive but am still getting issues where it is trying to write to C. Looking around, I found reference to setting windows environment variables "TEMP" and "TMP" to a different location but cannot work out how to implement this. Thoughts?


class xx():
    def __init__(self):
        self.scratch = 't:/right_here'
    def xy(self):
        arcpy.env.scratchWorkspace = self.scratch
        expand = EucAllocation('t:/over_here/raster', '1')

ERROR 010296: Error in writing raster c:\users\me\appdata\local\temp\t_t403

I am still having problems with this.. Only seems to be euclidean allocation. I have as well set the env.workspace to a location not c:

  • I'm only seeing where you set the scratch workspace - try setting your current workspace? arcpy.env.workspace = 'whatever'
    – geodranic
    Nov 6, 2019 at 5:10

1 Answer 1


Found the answer: https://answers.microsoft.com/en-us/windows/forum/windows_7-files/change-location-of-temp-files-folder-to-another/19f13330-dde1-404c-aa27-a76c0b450818

I should have looked in environment variables sooner....

To change the location of the System Temp folder, follow the steps given below.

  1. Right click on Computer and click on Properties. In the resulting window with the basic information about your computer

  2. Click on Advanced system settings on the left panel resulting in a dialog box click on the Advanced tab a

  3. Click on the button near the bottom labeled Environment Variables.

  4. You may see both TMP and TEMP listed in the section labeled User variables for (account). That's the common location; each different login account is assigned its own temporary location.

  5. In the Variable value Edit box you may specify the path to the directory that Windows and many other programs will use for temporary files.

Be sure and repeat that process for both TMP and TEMP.

You'll need to restart any running programs for the new value to take effect. In fact, you'll need to restart Windows for it to begin using the new value for its own temporary files.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.