title: QT4Reactor / Scrapy / PyQt4
body: <p><strong>How to use Qt4Reactor the right way?</strong></p>
  
  <p>I have a PyQt4 Application running Scrapy to parse a website and show the results in the ui. </p>
  
  <p>When the user clicks a button, the scraper gets started in another process. The ui blocks and the scraper is running. When the scraper is finished, the data is shown in the ui. What I want is a non-blockung ui when Scrapy is running.</p>
  
  <p>Since Scrapy is build on top of twisted, I have to use a new <strong>process</strong> instead of a <strong>thread</strong> to start it from the ui. </p>
  
  <p><strong>My question is how to achieve a non-blocking ui as simple as possible?</strong> </p>
  
  <p>I tried to use Qt4Reactor like this:</p>
  
  <pre><code>if __name__ == "__main__":
  
      app = QtGui.QApplication(sys.argv)
  
      import qt4reactor
      qt4reactor.install()
  
      MainWindow = DiscogsRenamer()
      MainWindow.show()
  
      sys.exit(app.exec_())
      reactor.runReturn()
  </code></pre>
  
  <p>This results in an error:</p>
  
  <pre><code>Traceback (most recent call last):
      File "/home/f/work/py/discogs_renamer/main.py", line 224, in &lt;module&gt;
          qt4reactor.install()
      File "/usr/local/lib/python2.7/dist-packages/qt4reactor.py", line 338, in posixinstall
          installReactor(p)
      File "/usr/local/lib/python2.7/dist-packages/twisted/internet/main.py", line 32, in installReactor
          raise error.ReactorAlreadyInstalledError("reactor already installed")
  twisted.internet.error.ReactorAlreadyInstalledError: reactor already installed
  </code></pre>
  
  <p>I posted another question to this topic:
  <a href="https://stackoverflow.com/questions/15042784/integrate-scrapy-twisted-event-loop-in-pyqt4-main-loop">Integrate Scrapy/Twisted event loop in PyQt4 Main loop</a></p>
  
  <p>Thanks in advance.</p>