On Wed, 2016-06-29 at 16:01 -0700, Glyph wrote:
> 
> > On Jun 29, 2016, at 15:39, steven meier <commercial...@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
> _______________________________________________



thank you for the quick reply, you were right.
but because of the qt imports / Main class my file now basically has the
line:
from webchat import get_main_page

at the end with the rest unchanged....but at least it runs


_______________________________________________
Twisted-Python mailing list
Twisted-Python@twistedmatrix.com
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-python

Reply via email to