From f5813621fff3ca6720e7851bf9f914258f16b60c Mon Sep 17 00:00:00 2001 From: "Rafael H. Schloming" Date: Tue, 6 May 2008 18:31:11 +0000 Subject: QPID-1033: made loading of the spec file not fail if the results cannot be cached, e.g. due to an unwritable directory git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@653875 13f79535-47bb-0310-9956-ffa450edef68 --- python/qpid/spec010.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'python/qpid') diff --git a/python/qpid/spec010.py b/python/qpid/spec010.py index 03f60edc4e..1668729876 100644 --- a/python/qpid/spec010.py +++ b/python/qpid/spec010.py @@ -621,6 +621,7 @@ class Loader: def load(xml): fname = xml + ".pcl" + if os.path.exists(fname) and mtime(fname) > mtime(__file__): file = open(fname, "r") s = cPickle.load(file) @@ -630,7 +631,14 @@ def load(xml): s = doc["amqp"].dispatch(Loader()) s.register() s.resolve() - file = open(fname, "w") - cPickle.dump(s, file) - file.close() + + try: + file = open(fname, "w") + except IOError: + file = None + + if file: + cPickle.dump(s, file) + file.close() + return s -- cgit v1.2.1