decode_value
encode_value
get_config
help_text
HOME
init
initialized
is_game
is_system
load_config
lock
module_get_config
module_info
module_init
module_option
option
parse_args
pname
read_cache
read_config
read_data
read_runtime
read_spool
remove_cache
remove_config
remove_data
remove_runtime
remove_spool
remove_temp
save_config
unlock
version_text
write_cache
write_config
write_data
write_log
write_runtime
write_spool
write_temp
XDG_CACHE_HOME
XDG_CONFIG_DIRS
XDG_CONFIG_HOME
XDG_DATA_DIRS
XDG_DATA_HOME
XDG_RUNTIME_DIR

## write_temp()

def fhs.write_temp | ( |  | dir = `False`,
|  |  | text = `True`,
|  |  | packagename = `None`
| ) |  |

Open a temporary file for writing.

The file is automatically removed when the program exits. If this function is used in a with statement, the file is removed when the statement finishes.

Unlike other write_* functions, this one has no option to get the filename without opening the file, because that is a security risk for temporary files. However, the returned object is really a wrapper that looks like a file, but has one extra attribute: "filename". This can be used in cases where for other file types "opened = False" would be appropriate. It also has an extra method: "remove". This takes no arguments and removes the file immediately. "remove" should not be called multiple times.

Parameters

  dir | If False (the default), a file is created. If True, a directory is created and the name is returned. On remove, the directory contents are recursively removed.
  text | If True (the default), the file is opened in text mode. This parameter is ignored if dir is True.
  packagename | Override the packagename.

Returns
  The file, or the name of the directory.

Definition at line 892 of file fhs.py.

Here is the caller graph for this function: