geofileops.options.set_remove_temp_files#

static options.set_remove_temp_files(enable: bool | None) _RestoreOriginalHandler#

Enable or disable removal of temporary files created during operations.

If not set, the option is enabled by default, so temporary files are removed after the operation is complete.

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_REMOVE_TEMP_FILES to “TRUE” or “FALSE”.

Added in version 0.11.0.

Parameters:

enable (bool | None) – If True, temporary files will be removed after operations. If False, temporary files will be kept. 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_remove_temp_files(False)

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

with gfo.options.set_remove_temp_files(False):
    gfo.buffer(...)