Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

On passing arguments to super class, an error flags: "module.__init__() takes at most 2 arguments (3 given)"? [duplicate]

class info:
    def __init__(self, **kwargs):
        self._variables = kwargs


class waybill(info):
    def __init__(self, **kwargs):
        super(waybill, self).__init__(**kwargs)

Error -: module.__init__() takes at most 2 arguments (3 given)

What could probably the reason why this error is flagging? I am using Python 3.2

like image 376
LEMUEL ADANE Avatar asked Jul 16 '11 04:07

LEMUEL ADANE


2 Answers

Is info defined in the same file? Or is it info.info from info.py? If you're importing info, trying changing it to the following:

from info import info

Additional information: If you simply import info then info is a module, and waybill is subclassing module.

like image 78
Eryk Sun Avatar answered Nov 14 '22 22:11

Eryk Sun


super(waybill, self).__init__(kwargs)

should be:

super(waybill, self).__init__(**kwargs)
like image 38
Dan D. Avatar answered Nov 14 '22 23:11

Dan D.