def dump(self, channel, filename): filename = conf.supybot.directories.data.dirize(filename) fd = utils.transactionalFile(filename) out = csv.writer(fd) db = self._getDb(channel) cursor = db.cursor() cursor.execute("""SELECT name, added, subtracted FROM karma""") for (name, added, subtracted) in cursor.fetchall(): out.writerow([name, added, subtracted]) fd.close()