Pickle problem

Gumuz gumuz at looze.net
Tue Nov 19 05:06:01 EST 2002


still stuck... anyone?


"Pierre Rouleau" <pieroul at attglobal.net> wrote in message
news:3DD9A03A.3090108 at attglobal.net...
>
>
> Guyon Morée wrote:
> > 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.
> >
> >
>
> Just a guess...
> The Open() function is nested inside Save().  Is it what you intended?
> If so, you may have a problem with the access to the Site class.
>
> --
>          Pierre Rouleau
>





More information about the Python-list mailing list