Matthew Thorley wrote:
> I am trying to inherit from ElementTree so I can add some methods. This
> is the code I am trying to make work, and the following is the error I
> am getting.
>
> from elementtree import ElementTree
> class AcidTree(ElementTree):
> def write_string(self):
> ....
>
> File "/home/hope/var/proj/acid/server/mgacparse.py", line 22, in ?
> class AcidTree(ElementTree):
> TypeError: Error when calling the metaclass bases
> module.__init__() takes at most 2 arguments (3 given)
>
> I have *no* idea what is going on here.
note that you're trying to inherit from a module. the error message could
need some work...
something like
from elementtree.ElementTree import ElementTree, tostring
class AcidTree(ElementTree):
def write_string(self):
return tostring(self)
should work better.
</F>
--
http://mail.python.org/mailman/listinfo/python-list