<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><TITLE></TITLE>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.3492" name=GENERATOR></HEAD>
<BODY><!-- Converted from text/plain format -->
<P><FONT face=Arial size=2>Hi Chris,<BR><BR>> -----Original
Message-----<BR>> From: chris@rebertia.com [</FONT><A
href="mailto:chris@rebertia.com"><FONT face=Arial
size=2>mailto:chris@rebertia.com</FONT></A><FONT face=Arial size=2>] On<BR>>
Behalf Of Chris Rebert<BR>> Sent: Thursday, February 19, 2009 22:58<BR>>
To: Barak, Ron<BR>> Cc: python-list@python.org;
wxpython-users@lists.wxwidgets.org<BR>> Subject: Re: "metaclass conflict"
error: where is noconflict ?<BR>><BR>> On Thu, Feb 19, 2009 at 5:01 AM,
Barak, Ron <Ron.Barak@lsi.com> wrote:<BR>> > Hi,<BR>>
><BR>> > I have a class derived from two parents (in blue
below),<BR>> which gives<BR>> > me the following error:<BR>>
><BR>> > $ python -u ./failover_pickle_demo09.py Traceback (most recent
call<BR>> > last):<BR>> > File
"./failover_pickle_demo09.py", line 291, in <module><BR>>
> class ListControl(wx.Frame, CopyAndPaste):<BR>>
> TypeError: Error when calling the metaclass bases<BR>>
> metaclass conflict: the metaclass of a derived
class must be a<BR>> > (non-strict) subclass of the metaclasses of all its
bases Googling<BR>> > suggested I should add from noconflict import
classmaker and<BR>> ><BR>> > __metaclass__=classmaker()<BR>> >
to this class.<BR>> ><BR>> > However, I don't seem able to find
where to get the<BR>> noconflict module from.<BR>> ><BR>> > Do
any of you where noconflict could be downloaded/installed from
?<BR>><BR>> From what I could google, you should in theory be able to
fix<BR>> the problem (without using any 3rd party module) by
doing:<BR>><BR>> class ListControlMeta(type(wx.Frame),
type(CopyAndPaste)):<BR>> pass<BR>><BR>> class
ListControl(wx.Frame, CopyAndPaste):<BR>>
__metaclass__ = ListControlMeta<BR>> #rest of
class...<BR>><BR>> Cheers,<BR>> Chris<BR><BR>Applying your
suggestion:<BR><BR><FONT face=Courier>class ListControlMeta(type(wx.Frame),
type(CopyAndPaste)):<BR> pass<BR><BR>class
ListControl(wx.Frame, CopyAndPaste):<BR> def __init__(self,
parent, id, title, list, max_list_width, log_stream,
style=wx.DEFAULT_FRAME_STYLE):<BR><BR>
__metaclass__= ListControlMeta<BR><BR>
wx.Frame.__init__(self,parent,id,title,size=(max_list_width,-1),
style=style)<BR> self.list =
list<BR> self.log_stream =
log_stream<BR> self.list_ctrl =
wx.ListCtrl(self, -1, style=wx.LC_REPORT |
wx.LC_NO_HEADER)<BR>
self.list_ctrl.InsertColumn(0,
title)<BR> for i,line_ in
enumerate(list):<BR>
self.list_ctrl.InsertStringItem(i,
line_)</FONT><BR>
...<BR><BR>I get:<BR><BR><FONT
face=Courier>$ python -u ./failover_pickle_demo09.py<BR>Traceback (most recent
call last):<BR> File "./failover_pickle_demo09.py", line 319, in
<module><BR> class ListControlMeta(type(wx.Frame),
type(CopyAndPaste)):<BR>TypeError: Error when calling the metaclass
bases<BR> multiple bases have instance lay-out
conflict</FONT><BR><BR>So, back to trying to understand...<BR><BR>Thanks and
bye,<BR>Ron.<BR>><BR>> --<BR>> Follow the path of the Iguana...<BR>>
</FONT><A href="http://rebertia.com"><FONT face=Arial
size=2>http://rebertia.com</FONT></A><BR><FONT face=Arial size=2>>
</FONT></P></BODY></HTML>