summaryrefslogtreecommitdiff
path: root/python/qpid/spec010.py
diff options
context:
space:
mode:
Diffstat (limited to 'python/qpid/spec010.py')
-rw-r--r--python/qpid/spec010.py14
1 files changed, 11 insertions, 3 deletions
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