[Twisted-Python] qt5 and twisted, reactor already installed, python 2.x

Glyph Lefkowitz glyph at twistedmatrix.com
Thu Jun 30 16:09:20 MDT 2016


> On Jun 30, 2016, at 03:49, steven meier <commercials24 at yahoo.de> wrote:
> 
> 
>> 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.
> 
> 
> So twisted modules should not at all import the reactor but rely on the
> user code todo that?

Yes.  Unfortunately, lots of places do import the reactor directly today, but we have long since decided that this is a bad way to do things.  This is why e.g. react <https://twistedmatrix.com/documents/16.2.0/api/twisted.internet.task.html#react> passes the reactor to your function as a parameter, so you can pass it on down to any other code that needs it.

-glyph

-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/twisted-python/attachments/20160630/2ff752aa/attachment-0002.html>


More information about the Twisted-Python mailing list