title: Python: RuntimeError: super-class __init__() of %S was never called
body: <p>I tried to do some operation (<code>setParent</code>) on an object in Python (an instance of a class which inherits from a different class - to be specific, <code>QtGui.QLabel</code>), but during runtime the above error was raised. The object itself has had some fields with actual content (verified on debug), but from some reason I couldn't "use" it. What does the error mean and how can I fix it? For some additional information, I shall say that the object was returned from a static method before I tried to do this operation on it.</p>
  
  <p>The subclass has a <code>__init__()</code> function of its own:</p>
  
  <pre><code>def __init__(self, image, father):
          super(AtomicFactory.Image, self).__init__(father)
          self.raw_attributes = image.attributes
          self.attributes = {}
          father.addChild(self)
          self.update()
  </code></pre>
  
  <p>Now I wrote a similar code, a simple one, that had the same error on the line <code>widget.setParent(mw)</code> when the window was moved.</p>
  
  <pre><code>#!/usr/bin/env python
  import sys
  import copy
  from PyQt4 import QtCore, QtGui
  
  if __name__ == "__main__":
      app = QtGui.QApplication(sys.argv)
      main_widget=QtGui.QWidget()
      widget = QtGui.QPushButton('Test')
      widget.resize(640, 480)
      widget.setParent(main_widget)
      widget.move(0, 0)
      widget2=QtGui.QPushButton('Test2')
      widget2.i=0
      widget2.resize(600, 200)
      widget2.setParent(main_widget)
      widget2.move(640, 0)
      def onResize(event):
          print event
          mw=copy.deepcopy(main_widget)
          widget.setParent(mw)
          widget2.setParent(mw)
          widget.move(0, 0)
          widget2.move(640, 480)
          main_widget_width=main_widget.width()
          widget_width=widget.width()
          width2=main_widget_width-widget_width
          height2=widget2.height()
          widget2.resize(width2, height2)
          widget2.move(640, 0)
      main_widget.resizeEvent=onResize
      def onClick():
          size=(widget2.width(), widget2.height())
          if(widget2.i%2==0):
              widget2.resize(int(size[0]/2), int(size[1]/2))
          else:
              widget2.resize(size[0]*2, size[1]*2)
          widget2.i+=1
      QtCore.QObject.connect(widget, QtCore.SIGNAL('clicked()'), onClick)
      main_widget.show()
      sys.exit(app.exec_())
  </code></pre>
  
  <p>What was the problem?</p>