Re: Automatic reloading, metaclasses, and pickle

2007-02-28 Thread andrewfelch
On Feb 27, 6:47 pm, Ziga Seilnacht [EMAIL PROTECTED] wrote: Andrew Felch wrote: Thanks for checking. I think I narrowed the problem down to inheritance. I inherit from list or some other container first: class PointList( list, AutoReloader ): def PrintHi1(self): print Hi2

Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at: http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1) pickle an object that inherits from AutoReloader 2) unpickle the object 3) modify one of the pickled'

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1) pickle an object that inherits from AutoReloader 2) unpickle the object 3)

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:50 pm, Ziga Seilnacht [EMAIL PROTECTED] wrote: Andrew Felch wrote: Hello all, I'm using the metaclass trick for automatic reloading of class member functions, found at:http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/160164 My problem is that if I 1) pickle an

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: Thanks Ziga. I use pickle protocol 2 and binary file types with the command: cPickle.dump(obj, file, 2) I did your suggestion, i commented out the __call__ function of MetaInstanceTracker and copied the text to the __new__ function of AutoReloader (code appended). I

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 5:30 pm, Ziga Seilnacht [EMAIL PROTECTED] wrote: Andrew Felch wrote: Thanks Ziga. I use pickle protocol 2 and binary file types with the command: cPickle.dump(obj, file, 2) I did your suggestion, i commented out the __call__ function of MetaInstanceTracker and copied the

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: I pasted the code into mine and replaced the old. It seems not to work for either unpickled objects or new objects. I add methods to a class that inherits from AutoReloader and reload the module, but the new methods are not callable on the old objects. Man! It seems

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:23 pm, Ziga Seilnacht [EMAIL PROTECTED] wrote: Andrew Felch wrote: I pasted the code into mine and replaced the old. It seems not to work for either unpickled objects or new objects. I add methods to a class that inherits from AutoReloader and reload the module, but the new

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread Ziga Seilnacht
Andrew Felch wrote: Thanks for checking. I think I narrowed the problem down to inheritance. I inherit from list or some other container first: class PointList( list, AutoReloader ): def PrintHi1(self): print Hi2 class MyPrintingClass( AutoReloader ): def

Re: Automatic reloading, metaclasses, and pickle

2007-02-27 Thread andrewfelch
On Feb 27, 3:47 pm, Ziga Seilnacht [EMAIL PROTECTED] wrote: Andrew Felch wrote: Thanks for checking. I think I narrowed the problem down to inheritance. I inherit from list or some other container first: class PointList( list, AutoReloader ): def PrintHi1(self): print Hi2