[Twisted-Python] qt5 and twisted, reactor already installed, python 2.x
Glyph
glyph at twistedmatrix.com
Wed Jun 29 17:01:17 MDT 2016
> On Jun 29, 2016, at 15:39, steven meier <commercials24 at yahoo.de> wrote:
>
>
> here is my code:
> when importing get_main_page i get the error above...
>
> import sys
> from PyQt5 import QtWidgets
> from untitled import Ui_MainWindow
> #from webchat import get_main_page
You have to put the qt5reactor installation at the very top of the very first file that you run. What's happened here is that you imported some Twisted code that did 'from twisted.internet import reactor' at the top level, which unfortunately far too many modules do, before you installed the qt5 reactor.
For this and other reasons, you should always put your `if __name__ == '__main__'` block - if you have one at all - at the very top of your script, not the bottom. This blog post may be informative: https://moshez.wordpress.com/2016/06/07/__name__-__main__-considered-harmful/
-glyph
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20160629/3ce8aeb3/attachment-0002.html>
More information about the Twisted-Python
mailing list