Pickle problem
Guyon Morée
gumuz at looze.net
Mon Nov 18 19:00:11 EST 2002
Hi all,
i have a pickle problem, can;t figure it out :(
i have a class called 'site'
site has a root 'folder' class
a folder class can contain 'pages' and other 'folder', ike a sort of tree.
now i have the open and save function done like this:
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
def Save(self, Filename):
outFile = open(Filename,'w')
pickle.dump(self,outFile)
outFile.close()
def Open(self, Filename):
inFile = open(Filename)
self = pickle.load(inFile)
inFile.close()
print str(self.Root.Pages)
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
now i get the following error on the 'pickle.load' function:
Traceback (most recent call last):
File "E:\Development\Projects\Python\pyBlogg\pyBlogg.py", line 46, in Open
self = pickle.load(inFile)
File "C:\PROGRA~1\Python22\lib\pickle.py", line 981, in load
return Unpickler(file).load()
File "C:\PROGRA~1\Python22\lib\pickle.py", line 596, in load
dispatch[key](self)
File "C:\PROGRA~1\Python22\lib\pickle.py", line 766, in load_inst
klass = self.find_class(module, name)
File "C:\PROGRA~1\Python22\lib\pickle.py", line 823, in find_class
klass = getattr(mod, name)
AttributeError: 'module' object has no attribute 'Site'
and yes, my module _does_ have a Site -class.
please advice,
thankyou,
guyon
More information about the Python-list
mailing list