Select to view content in your preferred language

Specifying location of temporary files created during python scripting

5148
2
Jump to solution
07-28-2014 07:00 AM
SheldonBrown
New Contributor III

Hi all,

I'm having some relatively large temporary files created on my primary hard drive during python scripting with arcpy. Their location appears to default to C:\%appdata%\Local\Temp. I need them to be stored in a different location. I came across a couple postings suggesting to set the ARCTMPDIR environment variable to a different directory, and I've done that, but it doesn't seem to help. The temp files are still created on the C drive.

Are there any other things I can try?

Thanks.

0 Kudos
1 Solution

Accepted Solutions
SheldonBrown
New Contributor III

Thanks, Tim. Setting the scratch workspace to the temporary directory didn't help.

I additionally had to set the other two windows environment variables "TEMP" and "TMP" to the location of the temporary directory. The files go where expected now, and space will no longer be a constraint. Geoprocessing bliss!

View solution in original post

0 Kudos
2 Replies
TimWitt2
MVP Alum

You should be able to specify it in your python code using the following code:

import arcpy
arcpy.env.scratchWorkspace = "c:/LandUse/ForestCover"

Hope this helps!

Tim

SheldonBrown
New Contributor III

Thanks, Tim. Setting the scratch workspace to the temporary directory didn't help.

I additionally had to set the other two windows environment variables "TEMP" and "TMP" to the location of the temporary directory. The files go where expected now, and space will no longer be a constraint. Geoprocessing bliss!

0 Kudos