[Twisted-Python] Simple Epoll Reactor question

Andrew Francis andrewfr_ice at yahoo.com
Sun Jul 19 10:08:12 MDT 2009


Hello Glyph et al:

Message: 6
Date: Sat, 18 Jul 2009 16:11:42 -0400
From: Glyph Lefkowitz <glyph at twistedmatrix.com>
Subject: Re: [Twisted-Python] Simple Epoll Reactor question
To: Twisted general discussion <twisted-python at twistedmatrix.com>
Message-ID:
    <d9047f780907181311r29018280n3d4fdd578d60a270 at mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On Sat, Jul 18, 2009 at 2:41 PM, Andrew Francis<andrewfr_ice at yahoo.com> wrote:

> What am I doing wrong? Thanks in advance.

The first google hit for "epollreactor api" is:
<http://twistedmatrix.com/documents/8.2.0/api/twisted.internet.epollreactor.html>.

And I read that page.

>The two lines of code there are the *only* things your program should
>do in order to use the epoll reactor.  (Actually, you should just use
>the '-r' option to 'twistd', but I digress.)  After those lines are
>run, your program should 'from twisted.internet import reactor' as
>usual.

Okay I restructured the code as

from twisted.internet import epollreactor
epollreactor.install()
from twisted.internet import reactor

and this works. Thanks. Before I was getting "reactor already installed" errors when I used epollreactor.install() (this is to answer Cary Hull's question about commenting out that line).

Adding 'from twisted.internet import reactor' wasn't obvious to me. Perhaps this should also be mentioned on the "Choosing a Reactor" page for completeness?

Cheers,
Andrew  








      




More information about the Twisted-Python mailing list