diff options
-rwxr-xr-x | potpourri/ca-pickle.py | 13 | ||||
-rwxr-xr-x | potpourri/ca-unpickle.py | 2 |
2 files changed, 8 insertions, 7 deletions
diff --git a/potpourri/ca-pickle.py b/potpourri/ca-pickle.py index 92741853..2c63e978 100755 --- a/potpourri/ca-pickle.py +++ b/potpourri/ca-pickle.py @@ -55,15 +55,15 @@ for section in ("rpkid", "irdbd", "pubd"): databases[section] = tables filenames = [cfg.filename] -raw_config = {} -cooked_config = {} +raw_config = dict((section, {}) for section in cfg.cfg.sections()) +cooked_config = dict((section, {}) for section in cfg.cfg.sections()) for section in cfg.cfg.sections(): for option in cfg.cfg.options(section): - raw_config[section, option] = cfg.cfg.get(section = section, option = option) - cooked_config[section, option] = cfg.get(section = section, option = option) - if os.path.isfile(cooked_config[section, option]): - filenames.append(cooked_config[section, option]) + raw_config [section][option] = cfg.cfg.get(section = section, option = option) + cooked_config[section][option] = cfg.get(section = section, option = option) + if os.path.isfile( cooked_config[section][option]): + filenames.append(cooked_config[section][option]) for i, fn in enumerate(filenames): filenames[i] = os.path.abspath(fn) @@ -89,6 +89,7 @@ xz = subprocess.Popen( cPickle.dump(world, xz.stdin, args.protocol) +xz.stdin.flush() xz.stdin.close() if xz.wait() != 0: diff --git a/potpourri/ca-unpickle.py b/potpourri/ca-unpickle.py index dbbe3e8a..5f255d8f 100755 --- a/potpourri/ca-unpickle.py +++ b/potpourri/ca-unpickle.py @@ -20,7 +20,7 @@ args = parser.parse_args() xzcat = subprocess.Popen(("xzcat", args.input), stdout = subprocess.PIPE) world = cPickle.load(xzcat.stdout) if xzcat.wait() != 0: - sys.exit("XZ unpickling failed with code {}".format(xz.returncode)) + sys.exit("XZ unpickling failed with code {}".format(xzcat.returncode)) print "import datetime" print "world =", repr(world) |