"metaclass conflict" error: where is noconflict ?
Hrvoje Niksic
hniksic at xemacs.org
Sun Feb 22 12:44:04 EST 2009
"Barak, Ron" <Ron.Barak at lsi.com> writes:
> 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
You don't need ListControlMeta at all; just inherit from wx.Frame and
(new-style) CopyAndPaste directly.
> $ 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
Are you sure you're executing the latest version where CopyAndPaste is
a new-style class? The equivalent code works for me:
>>> import wx
>>> class CopyAndPaste(object):
... pass
...
>>> class ListControl(wx.Frame, CopyAndPaste):
... pass
...
>>> # no error
Could it be that you're using an older version of wx, where wx.Frame
itself is an old-style class?
More information about the Python-list
mailing list