Metaclass conflict TypeError exception: problem demonstration script

Gabriel Genellina gagsl-py2 at yahoo.com.ar
Mon Feb 23 10:38:43 CET 2009


En Mon, 23 Feb 2009 07:32:52 -0200, Barak, Ron <Ron.Barak at lsi.com>  
escribió:

> $ cat -n metaclass_test01.py | head
>      1  #!/usr/bin/env python
>      2
>      3  import sys
>      4  import wx
>      5  import CopyAndPaste
>      6
>      7  class ListControl(wx.Frame, CopyAndPaste):
>      8  #class ListControl(wx.Frame):
>      9      def __init__(self, parent, id, title, list, max_list_width):
>     10          wx.Frame.__init__(self,parent,id,title,size=(-1,-1),  
> style=wx.DEFAULT_FRAME_STYLE)
>
> I get the metaclass conflict exception:
>
> $ python metaclass_test01.py
> Traceback (most recent call last):
>   File "metaclass_test01.py", line 7, in <module>
>     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 hope that now the problem is demonstrated more clearly, and the gurus  
> out there could point me in the right direction towards a solution.

You want the CopyAndPaste *class*, not the *module*!

-- 
Gabriel Genellina




More information about the Python-list mailing list