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

example gen.py not working #49

Open
antipooh opened this issue Jun 27, 2012 · 5 comments
Open

example gen.py not working #49

antipooh opened this issue Jun 27, 2012 · 5 comments

Comments

@antipooh
Copy link

On run example gen.py on tornado 2.3 raised exception

ERROR:root:Failed to handle message: Traceback (most recent call last):
  File "/home/pooh/works/testtornado/lib/python2.6/site-packages/tornadio2/persistent.py", line 142, in on_message
    self.session.raw_message(message)
  File "/home/pooh/works/testtornado/lib/python2.6/site-packages/tornadio2/session.py", line 410, in raw_message
    ack_response = conn.on_event(event['name'], args=args)
  File "/home/pooh/works/testtornado/lib/python2.6/site-packages/tornadio2/gen.py", line 113, in wrapper
    run(args, kwargs)
  File "/home/pooh/works/testtornado/lib/python2.6/site-packages/tornadio2/gen.py", line 84, in run
    data.runner = SyncRunner(gen, finished)
  File "/home/pooh/works/testtornado/lib/python2.6/site-packages/tornadio2/gen.py", line 45, in __init__
    super(SyncRunner, self).__init__(gen)
TypeError: __init__() takes exactly 3 arguments (2 given)

I replace in file tornadio2/gen.py line 84
from

data.runner = SyncRunner(gen, finished)

on

data.runner = Runner(gen, finished)

I think class SyncRunner no more need

@mrjoes mrjoes closed this as completed Feb 19, 2013
@faxioman
Copy link

faxioman commented Mar 2, 2013

Why issue closed? I have the same problem ...

@mrjoes
Copy link
Owner

mrjoes commented Mar 3, 2013

Because I can not reproduce it. Works without any problems on Tornado 2.4.1.

@faxioman
Copy link

faxioman commented Mar 3, 2013

I see the Runner class of tornado 2.4.1 and has a new parameter in init:

def __init__(self, gen, deactivate_stack_context):

SyncRunner calls the super init in this way:

super(SyncRunner, self).__init__(gen)

I think this is the problem.

@mrjoes
Copy link
Owner

mrjoes commented Mar 3, 2013

Ah, this is interoperability issue between engine and sync_engine. gen.py example works because it is using sync_engine.

Edit: If you don't care about executing actions in order, feel free to use standard tornado.gen.engine

@mrjoes mrjoes reopened this Mar 3, 2013
@faxioman
Copy link

faxioman commented Mar 3, 2013

I think i'm using sync_engine too.
In my class:

class MeteoDataSetAPI(SocketConnection):
    ...
    @gen.sync_engine
    def on_event(self, name, *args, **kwargs):
        return super(MeteoDataSetAPI, self).on_event(name, *args, **kwargs)

Is it right?

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

3 participants