Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error thrown by call_later() #1169

Closed
ealione opened this issue Apr 18, 2018 · 2 comments
Closed

Error thrown by call_later() #1169

ealione opened this issue Apr 18, 2018 · 2 comments

Comments

@ealione
Copy link

ealione commented Apr 18, 2018

I am getting the following error thrown when I try to delay the call of a function

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 1209, in _run
    return self.callback()
  File "/home/pi/test.py", line 123, in _tick
    self._delayed_cb = IOLoop.call_later(self._create_stream, 5000)
TypeError: unbound method call_later() must be called with ZMQIOLoop instance as first argument (got instancemethod instance instead)

The code causing this issue is the following:

self._delayed_cb = IOLoop.call_later(self._create_stream, 5000)
self._delayed_cb.start()

Has something changed in the way call_later works, or is it something I am doing wrong?

@ealione
Copy link
Author

ealione commented Apr 18, 2018

Changing to DelayedCallback causes issues too

Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/tornado/ioloop.py", line 1209, in _run
    return self.callback()
  File "dedalus/test.py", line 124, in _tick
    self._delayed_cb = DelayedCallback(self._create_stream, 5000)
  File "/usr/local/lib/python2.7/dist-packages/zmq/eventloop/ioloop.py", line 56, in __init__
    super(DelayedCallback, self).__init__(callback, callback_time, io_loop)
TypeError: __init__() takes exactly 3 arguments (4 given)

Could it have something to do with my pyzmq and tornado?

tornado==5.0.1
pyzmq==16.0.2

@minrk
Copy link
Member

minrk commented Aug 20, 2018

call_later is an instance method, not a class method. You would use it after getting the current loop, e.g.:

IOLoop.current().call_later(2, func)

@minrk minrk closed this as completed Feb 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants