title: Inheritance in Python: "TypeError: run() takes no arguments (2 given)"
body: <p>I see other topics similar to this one, but not really what I need.</p>
  
  <p>I have a class named "Base" where there calls for several methods. At the end of it is its own "run":</p>
  
  <pre><code>class BaseComponent(OSUtils):
  
      def __init__(self, cpio):
          OSUtils.__init__(self, cpio.logger)
          self.io = cpio
  
      def debug(self, msg):
          print("[Debug] %s" % msg)
          self.logger.debug(msg)
  
      def start(self, debug=False):
  
          try:
              self.info("--- Running %s:" % self.__class__.__name__)
              print self.__class__.__name__
              self.run(debug)
  
      def run(debug=False):
          component = BaseComp(cpio.ComponentIO())
          component.start(debug)    
  
  if __name__ == '__main__':
      print ("Testing")
  </code></pre>
  
  <p>I have another class, called "BaseComp" that extends "Base" with methods specific for a given need, on it there is a "run" method that must be rewritten and at the end of it the "run" of the class itself:</p>
  
  <pre><code>import dummy.io as cpio
  class BaseComp(Base):
  
     def __init__(self, cpio):
         Base.__init__(self, cpio)
         self.io = cpio
  
     def run(self, debug=False):
         #this method will be rewritten latter
         #no matter what goes below
         #
         msg="blahblahblah"
         Exception(msg)
  
  def run(debug=False):
      component = BaseComp(cpio.ComponentIO())
      component.start(debug)    
  
  if __name__ == '__main__':
      print ("Testing")
  </code></pre>
  
  <p>This class is extended by another one called Hello. Hello rewrites the method "run" of BaseComp and also has its own "run" at the end. In this run there is a call to "component.start(debug)</p>
  
  <pre><code>from base_components import BaseComp
  import dummy.io as cpio
  class Hello(BaseComp):
  
      def run(self, debug=True):
          print "Begin"
          msg="hello world"
          print "End"
  
  def run(debug=True):
      component = Hello(cpio.ComponentIO())
      component.start(debug)
  
  if __name__ == '__main__':
  
      print("Testing Start")
      run(debug = True)
      print("Test End")
  </code></pre>
  
  <p>component.start(debug) calls the method start from the first class ("Base")</p>
  
  <p>However when this call is made I get</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;string&gt;", line 1, in &lt;module&gt;
    File "/home/user/components/comp1/__init__.py", line 166, in run component.start()
    File "/home/user/directory/apps/Base.py", line 58, in start self.run(debug)  ***** this is in the start method 
  TypeError: run() takes no arguments (2 given)
  </code></pre>
  
  <p>I don't know what is causing the error. I believe it may be related with so many "run" methods being called</p>
  
  <p>This is driving me crazy because I am a bit lost in the whole inheritance schema</p>
  
  <p>Any help would be wonderfull</p>
  
  <p>thks</p>