title: How to avoid the warning “QApplication was not created in main() thread” without having access to the main thread?
body: <p>I wrote code in PyQt4 that scrapes a website and its inner frames.  </p>
  
  <pre><code>import sys, signal
  from PyQt4 import QtGui, QtCore, QtWebKit
  
  class Sp():
    def save(self, ok, frame=None):
      if frame is None:
        print ('main-frame')
        frame = self.webView.page().mainFrame()
      else:
        print('child-frame')
      print('URL: %s' % frame.baseUrl().toString())
      print('METADATA: %s' % frame.metaData())
      print('TAG: %s' % frame.documentElement().tagName())
      print('HTML: ' + frame.toHtml())
      print()
  
    def handleFrameCreated(self, frame):
      frame.loadFinished.connect(lambda: self.save(True, frame=frame))
  
    def main(self):
      self.webView = QtWebKit.QWebView()
      self.webView.page().frameCreated.connect(self.handleFrameCreated)
      self.webView.page().mainFrame().loadFinished.connect(self.save)
      self.webView.load(QtCore.QUrl("http://www.w3schools.com/tags/tryit.asp?filename=tryhtml_iframe_scrolling"))
  
  signal.signal(signal.SIGINT, signal.SIG_DFL)
  print('Press Crtl+C to quit\n')
  app = QtGui.QApplication(sys.argv)
  s = Sp()
  s.main()
  sys.exit(app.exec_())  
  </code></pre>
  
  <p>This code depends on creating an instance of QApplication and exiting it accordingly.<br>
  The problem with this is that QApplication must be created and exited in the main thread.<br>
  I don't have access to the main thread in the project that i'm developing.<br>
  Is it possible to avoid the error “QApplication was not created in main() thread” in some way?<br>
  Maybe by rewriting the code for it to work without QApplication or somehow make QApplication work without the main thread?<br>
  <strong>Edit:</strong> I can edit the main thread if it doesn't intervene with its flow of the execution of its code, for example <code>app = QtGui.QApplication([])</code> wouldn't stop the flow but a function that hangs until some code in another thread would finish would be considered inapplicable.</p>