geofileops.options.set_tmp_dir#

static options.set_tmp_dir(path: str | PathLike[Any] | None) _RestoreOriginalHandler#

Set the directory to use for temporary files created during processing.

The value set should be a valid directory path. If not set, a subdirectory “geofileops” created in the system temp directory is used.

Remarks:

  • You can also set the option temporarily by using this function as a context manager.

  • You can also set the option by directly setting the environment variable GFO_TMPDIR to the desired temporary directory path.

Added in version 0.11.0.

Parameters:

path (PathLike | str | None) – The temporary directory path. If None, the option is unset (so the default behavior is used).

Examples

If you want to change the default value of the option in general, you can just call it as a function:

gfo.options.set_tmp_dir("/path/to/tmpdir")

If you want to temporarily change the option, you can use it as a context manager:

with gfo.options.set_tmp_dir("/path/to/tmpdir"):
    gfo.buffer(...)