'metaclass conflict' when trying to use class with multiple inheritence

Hi,

I have subclass of a wx.Frame called ListControl.
I wanted to add copy (from copy-and-paste) capabilities to ListControl class.

I changed the header of this class to be:

class ListControl(wx.Frame, CopyAndPaste):

where CopyAndPaste is attached.

However, trying to run now - the script gives me the following exception:

$ python -u ./failover_pickle_demo09.py
Traceback (most recent call last):
File “./failover_pickle_demo09.py”, line 325, in
class ListControl(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

I tried to read the (black magic? :slight_smile: material on the web on metaclasses, but my knowledge of Python/wxPython is obviously too limited to understand how metaclasses come into play here, and what the solution should be…

Could anyone point me in the right direction ?
Thanks,
Ron.

CopyAndPaste.py (3.9 KB)

···

You are using the module instead of the class you defined. :slight_smile:

You should use

from CopyAndPaste import CopyAndPaste

NOT

import CopyAndPaste

try to avoid using CamelCase for module names and you will avoid this kind of an error.

Peter

···

On Sun, Feb 22, 2009 at 1:10 PM, Barak, Ron Ron.Barak@lsi.com wrote:

Hi,

I have subclass of a wx.Frame called ListControl.
I wanted to add copy (from copy-and-paste) capabilities to ListControl class.

I changed the header of this class to be:

class ListControl(wx.Frame, CopyAndPaste):

where CopyAndPaste is attached.

However, trying to run now - the script gives me the following exception:

$ python -u ./failover_pickle_demo09.py
Traceback (most recent call last):
File “./failover_pickle_demo09.py”, line 325, in
class ListControl(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

I tried to read the (black magic? :slight_smile: material on the web on metaclasses, but my knowledge of Python/wxPython is obviously too limited to understand how metaclasses come into play here, and what the solution should be…

Could anyone point me in the right direction ?
Thanks,
Ron.


wxpython-users mailing list

wxpython-users@lists.wxwidgets.org

http://lists.wxwidgets.org/mailman/listinfo/wxpython-users


There is NO FATE, we are the creators.
blog: http://damoc.ro/