From: Daira Hopwood Date: Thu, 5 Sep 2013 18:15:22 +0000 (+0100) Subject: Mon Jul 2 19:15:55 BST 2012 david-sarah@jacaranda.org X-Git-Url: https://git.rkrishnan.org/%5B/frontends/flags/%3C?a=commitdiff_plain;h=8b4a0a157ef21cbcedd7ad883b1ad062d484a154;p=tahoe-lafs%2Ftahoe-lafs.git Mon Jul 2 19:15:55 BST 2012 david-sarah@jacaranda.org * If a stats.pickle file cannot be read, print a better error message. --- diff --git a/src/allmydata/stats.py b/src/allmydata/stats.py index 5c1cdb3d..ea0a7f85 100644 --- a/src/allmydata/stats.py +++ b/src/allmydata/stats.py @@ -12,6 +12,7 @@ from zope.interface import implements from foolscap.api import eventually, DeadReferenceError, Referenceable, Tub from allmydata.util import log +from allmydata.util.encodingutil import quote_output from allmydata.interfaces import RIStatsProvider, RIStatsGatherer, IStatsProducer class LoadMonitor(service.MultiService): @@ -252,7 +253,12 @@ class PickleStatsGatherer(StdOutStatsGatherer): if os.path.exists(self.picklefile): f = open(self.picklefile, 'rb') - self.gathered_stats = pickle.load(f) + try: + self.gathered_stats = pickle.load(f) + except Exception: + print ("Error while attempting to load pickle file %s.\nYou may need to delete this file.\n" % + quote_output(os.path.abspath(self.picklefile))) + raise f.close() else: self.gathered_stats = {}