Nicky Mac wrote: > Dear Python team, > I have studied the excellent documentation, and attempted to make use > of pickle thus: > > filename = 'my_saved_adventure' > import pickle > class object: > def __init__(self,i,.........t) : > self.id = i > ..... > > class world: > def __init__(self): > self.object > > class object: > def __init__(self,i, > > .....then Object instances of object are created ........ > > myworld = world; > myworld.Object = Object > fileobj = open(filename,'wb') > pickle.dump(myworld,fileobj); fileobj.close() > result = "saved your game to " + filename > > fileobj = open(filename,'rb') > myworld = pickle.load(fileobj); fileobj.close() > Object = myworld.Object > result = "restored your game from " + filename > > > The proecedures execute without error > but a file of only 21b is created containing " ?c__main__world q . > altho there are several k of object instance data. >
class Foo(object): pass object is a keyword and you're using it as an identifier -- https://mail.python.org/mailman/listinfo/python-list