Search code examples
macostwisted

twisted on mac problem


trying to run twisted on my mac and get the following error:

exceptions.ImportError: cannot import name poll

It fails on the line:

from twisted.internet import pollreactor

After some digging in google I found out that it's a problem with mac. But how can I fix that?


Solution

  • There is no pollreactor on OS X, because there is no poll (or - sometimes there is, it's complicated, but "no poll" is an okay first approximation).

    So, use another reactor instead. If you need to exceed the 1024 file descriptor limit of select, then there's kqueue. kqueuereactor probably works marginally well as is, but there has been some work to improve it. If supporting many sockets on OS X is important for you, you might want to help with that effort. See http://twistedmatrix.com/trac/ticket/1918