Reputation: 45224
I've been trying to follow the code in Eventloops and PyZMQ, specifically the following code:
from tornado.ioloop import IOLoop
from zmq.eventloop.ioloop import ZMQPoller
loop = IOLoop(ZMQPoller())
I'm trying this and I get this exception:
Traceback (most recent call last):
File "C:\Users\ACaron\Desktop\develop\spectator\site\lib\site-packages\tornado\testing.py", line 170, in setUp
self.io_loop = self.get_new_ioloop()
File "C:\Users\ACaron\Desktop\develop\spectator\tests\test_agent.py", line 16, in get_new_ioloop
return IOLoop(ZMQPoller())
TypeError: __new__() takes exactly 1 argument (2 given)
Looking at the documentation for Tornado's I/O loop, I can see that indeed, the IOLoop
class constructor does not accept arguments.
I'm guessing there are some API changes in Tornado. I'm using PyZMQ 14.3.0 and Tornado 3.2.1. Is this a bad combination of package versions? If not, what's the new way of doing things?
Upvotes: 1
Views: 1733
Reputation: 22134
This looks like outdated documentation - Tornado's IOLoop has never taken any documented arguments, although ZMQ used to use an undocumented argument in earlier versions of Tornado. I think using the install() function should work in current versions of Tornado. I'm not sure how to use the ZMQ IOLoop in a way that is AsyncTestCase-friendly. I think there's a subclass of IOLoop somewhere in the ZMQ codebase that you can instantiate directly.
Upvotes: 1