[Tutor] Class error
Henry Dominik
fiveholiday55 at hotmail.com
Sun Jun 17 18:49:31 CEST 2007
Hello people,
I was trying my hands on Python's Classes and have a first hurdle and can't
seem to get past it.
-----Below is the error message ------
Traceback (most recent call last):
File "C:/Development/python/EmplAddrBookEntry.py", line 3, in -toplevel-
class EmplAddrBookEntry(AddrBookEntry):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)
-----end-----------------
Here are the classes, and they are saved in diferent files
----------------------AddrBookEntry.py-------------------------------------
class AddrBookEntry(object):
'address book entry class'
def __init__(self, nm, ph):
self.name = nm
self.phone = ph
print 'Created instance of ', self.name
def updatePhone(self, newPh):
self.phone = newPh
print 'Updated the phone number to: ', self.phone
----------------------EmplAddrBookEntry.py-------------------------------------
import AddrBookEntry
class EmplAddrBookEntry(AddrBookEntry):
def __init__(self, nm, ph, id, em):
AddrBookEntry.__init__(self, nm, ph)
self.empid = id
self.email = em
def updateEmail(self, newEmail):
self.email = newEmail
print 'Updated with new email', self.email
-------------------------------------------------------------
The error message spills out onto the IDLE Python Shell window when I press
the F5.
Your help is highly appreciated.
--Dom
More information about the Tutor
mailing list