From 228f2bf61c14681180bc481a19e27df54d27e4e6 Mon Sep 17 00:00:00 2001 From: Janos SUTO Date: Sun, 23 Feb 2020 10:09:12 +0100 Subject: [PATCH] pilerpurge.py uses python3 Signed-off-by: Janos SUTO --- util/pilerpurge.py | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/util/pilerpurge.py b/util/pilerpurge.py index 8fcbccb7..d5e51d22 100755 --- a/util/pilerpurge.py +++ b/util/pilerpurge.py @@ -1,8 +1,7 @@ -#!/usr/bin/python +#!/usr/bin/python3 -import ConfigParser +import configparser import MySQLdb as dbapi -import StringIO import argparse import getpass import os @@ -22,9 +21,8 @@ opts = {} def read_options(filename="", opts={}): s = "[piler]\n" + open(filename, 'r').read() - fp = StringIO.StringIO(s) - config = ConfigParser.RawConfigParser() - config.readfp(fp) + config = configparser.ConfigParser() + config.read_string(s) opts['username'] = config.get('piler', 'mysqluser') opts['password'] = config.get('piler', 'mysqlpwd') @@ -229,7 +227,7 @@ def main(): str(opts['purged_stored_size']))) opts['db'].commit() - except dbapi.DatabaseError, e: + except dbapi.DatabaseError as e: print("Error %s" % e) if opts['db']: