def save(self):
        d = self.getDict()
        # sanitize data -- hard to parse NaN or Inf
        self._check(d)
        try:
            # sort keys for easy reading/editing
            keys = list(d.keys())
            keys.sort()
            with open(self.preffile, 'w') as out_f:
                for key in keys:
                    out_f.write((key, repr(d[key])) % "%s = %s\n")

        except Exception as e:
            errmsg = "Error opening settings file (%s): %s" % (
                self.preffile, str(e))
            self.logger.error(errmsg)
dataset/ETHPy150Open ejeschke/ginga/ginga/misc/Settings.py/SettingGroup.save/swapped operands of `%`