def __get__(self, obj, typ=None):
'__get__() -- retrives attribute from disk'
self.name = name
if self.name not in FileDescr.saved:
raise AttributeError, \
"%r used before assignment" % self.name
# open pickle file and load object; choke on failure
try:
f = open(self.name, 'r')
val = pickle.load(f)
f.close()
return val
except (pickle.UnpicklingError, IOError,
EOFError, AttributeError,
ImportError, IndexError), e:
raise AttributeError, \
"could not read %r: %s" % self.name
评论列表
文章目录