# SPDX-License-Identifier: LGPL-2.1-or-laterimport configparserimport sysc = configparser.ConfigParser()c.read("/etc/sos/sos.conf")try:print(c["global"]["tmp-dir"])except KeyError:# very expensive and internal API, but there is no official way to get the tmp-dir# https://github.com/sosreport/sos/issues/4074try:import sos.policiesprint(sos.policies.load().get_tmp_dir(None))except Exception as e:# in case the API changes, sane fallbackprint("Failed to get policy tmp-dir:", e, file=sys.stderr)print("/var/tmp")