Skip to content Skip to sidebar Skip to footer

Twisted Api For Couchbase Not Working With Python Tornado

I'm trying to run a Tornado server with Couchbase 4.0 Developer preview. import tornado.web import tornado.httpserver import tornado.options import tornado.ioloop import tornado.w

Solution 1:

In asynchronous programming, you only want to start an event loop (like IOLoop.start() or reactor.run()) once, at the top of your program. You're calling IOLoop.start(), so instead of calling reactor.run() you want to tell Twisted to use the Tornado IOLoop as its reactor. Before the import of reactor, do

import tornado.platform.twisted
tornado.platform.twisted.install()
from twisted.internetimport reactor

See http://www.tornadoweb.org/en/stable/twisted.html#twisted-on-tornado for more.

Once you've done this, you can call twisted libraries without having to start and stop the reactor.

Post a Comment for "Twisted Api For Couchbase Not Working With Python Tornado"