Automatic reloading, metaclasses, and pickle

andrewfelch at gmail.com andrewfelch at gmail.com
Tue Feb 27 18:36:35 EST 2007


On Feb 27, 3:23 pm, "Ziga Seilnacht" <ziga.seilna... at gmail.com> 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 methods are not callable on the old objects.  Man!  It seems we're
> > so close, it will be huge if this ends up working.  This stuff is so
> > over my head, I wish I could help in some additional way.
>
> > -Andrew
>
> Did you copy and paste the entire module? I fiddled almost all parts
> of
> the original code. I did some base testing and it worked for me. Could
> you post the traceback? Note that Google Groups messed up indentation;
> in MetaAutoReloader.__init__, the line starting with
> cls.__instance_refs__ should be at the same level as previous line.
>
> Did you restart Python? InstanceTracker, MetaInstanceTracker and
> MetaAutoReloader are not auto reloaded :).
>
> Ziga

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 PrintHi2(self):
        print "Hi2v2"

Automatic reloading works for MyPrintingClass but not for PointList.
Any ideas?

-Andrew




More information about the Python-list mailing list