<p>My application caches some data on disk.  Because the cache may be large, it should not be stored on a network drive.  It should persist between invocations of the application.  I have a mechanism for the user to choose a location, but would like the default to be sensible and "the right thing" for the platform.</p>

<p>What is the appropriate location for such a cache?  Is there an API for determining the appropriate location?  How do I call it from Python?</p>

Perhaps the
```
tempfile
```
module provides what you need. It uses the Windows Temp directory (which probably is not on a network drive) but you can specify a directory if you want to. Also for security reasons this module should be the right tool - if you use
```
tempfile.mkstemp()
```
the file is readable and writable only by the creating user ID.
Oh. I see you have just edited your question and that you need file persistence between invocations of the app. Then
```
tempfile
```
is not that ideal (even though you could choose not to delete your cache between invocations).