Ask Your Question

Revision history [back]

You should be able to set the environment variable TMPDIR to manage this. You can test by running this within Sage:

sage: from sage.misc.temporary_file import TMP_DIR_FILENAME_BASE
sage: TMP_DIR_FILENAME_BASE
<TemporaryDirectory '/var/folders/00/zrss7sdj3bzd23f2_gnspy2h0000gp/T/tmpojijqa_h'>

That is the result if I don't set TMPDIR. If I first do export TMPDIR=/Users/jpalmier/Desktop/temporary/ before starting Sage, then I see

sage: from sage.misc.temporary_file import TMP_DIR_FILENAME_BASE
sage: TMP_DIR_FILENAME_BASE
<TemporaryDirectory '/Users/jpalmier/Desktop/temporary/tmph25k47mi'>

I think this will only work if the directory already exists.