diff --git a/iwla.py b/iwla.py index b14e64b..aba885f 100755 --- a/iwla.py +++ b/iwla.py @@ -24,7 +24,7 @@ import shutil import sys import re import time -import pickle +import cPickle import gzip import importlib import argparse @@ -248,7 +248,7 @@ class IWLA(object): os.makedirs(base) with open(filename + '.tmp', 'wb+') as f, self._openDB(filename, 'w') as fzip: - pickle.dump(obj, f) + cPickle.dump(obj, f) os.fsync(f) f.seek(0) fzip.write(f.read()) @@ -258,9 +258,10 @@ class IWLA(object): if not os.path.exists(filename): return None + res = None with self._openDB(filename) as f: - return pickle.load(f) - return None + res = cPickle.load(f) + return res def _callPlugins(self, target_root, *args): self.logger.info('==> Call plugins (%s)' % (target_root))