module.__init__() takes at most 2 arguments error in Python
<p>I have 3 files, factory_imagenet.py, imdb.py and imagenet.py</p>

<p><strong>factory_imagenet.py has:</strong></p>

<pre><code>import datasets.imagenet
</code></pre>

<p>It also has a function call as       </p>

<pre><code>datasets.imagenet.imagenet(split,devkit_path))
...
</code></pre>

<p><strong>imdb.py has:</strong></p>

<pre><code>class imdb(object):
def __init__(self, name):
    self._name = name
    ...
</code></pre>

<p><strong>imagenet.py has:</strong></p>

<pre><code>import datasets
import datasets.imagenet
import datasets.imdb
</code></pre>

<p>It also has </p>

<pre><code>class imagenet(datasets.imdb):
    def __init__(self, image_set, devkit_path=None):
        datasets.imdb.__init__(self, image_set)
</code></pre>

<p>All three files are in the datasets folder.</p>

<p>When I am running another script that interacts with these files, I get this error:</p>

<pre><code>Traceback (most recent call last):
  File "./tools/train_faster_rcnn_alt_opt.py", line 19, in &lt;module&gt;
    from datasets.factory_imagenet import get_imdb
  File "/mnt/data2/abhishek/py-faster-rcnn/tools/../lib/datasets/factory_imagenet.py", line 12, in &lt;module&gt;
    import datasets.imagenet
  File "/mnt/data2/abhishek/py-faster-rcnn/tools/../lib/datasets/imagenet.py", line 21, in &lt;module&gt;
    class imagenet(datasets.imdb):
TypeError: Error when calling the metaclass bases
module.__init__() takes at most 2 arguments (3 given)
</code></pre>

<p>What is the problem here and what is the intuitive explanation to how to solve such inheritance problems? </p>

<p>When you call <code>datasets.imdb.__init__(self, image_set)</code><br>
Your <code>imdb.__init__</code> method gets 3 arguments. Two you send and third is implicit <code>self</code></p>

python inheritance