"metaclass conflict" error: where is noconflict ?

Barak, Ron Ron.Barak at lsi.com
Sun Feb 22 08:41:20 EST 2009


Hi Hrvoje,

I tried also as follows:

#!/usr/bin/env python

import wx

class CopyAndPaste(object):
    def __init__(self):
        pass

    def set_copy_and_paste(self):
    ...


and CopyAndPaste is being called with:

...
class ListControlMeta(wx.Frame, CopyAndPaste):
    pass

class ListControl(wx.Frame, CopyAndPaste):

    def __init__(self, parent, id, title, list, max_list_width, log_stream, style=wx.DEFAULT_FRAME_STYLE):

        wx.Frame.__init__(self,parent,id,title,size=(max_list_width,-1), style=style)
        self.list = list
        ...

But I'm still getting:

$ python -u ./failover_pickle_demo09.py
Traceback (most recent call last):
  File "./failover_pickle_demo09.py", line 324, in <module>
    class ListControlMeta(wx.Frame, CopyAndPaste):
TypeError: Error when calling the metaclass bases
    metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases

So, obviously the line in blue is not to Python's liking.

Bye,
Ron.

> -----Original Message-----
> From: Hrvoje Niksic [mailto:hniksic at xemacs.org]
> Sent: Sunday, February 22, 2009 14:05
> To: python-list at python.org
> Subject: Re: "metaclass conflict" error: where is noconflict ?
>
> "Barak, Ron" <Ron.Barak at lsi.com> writes:
>
> > class CopyAndPaste():
>
> CopyAndPaste is an old-style class.  Make it a new-style
> class, and you'll probably be able to inherit from it and
> wx.Frame without explicitly creating a new metaclass.
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090222/b4d71f61/attachment.html>


More information about the Python-list mailing list