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

Random error on init #55

Open
lucianobarcaro opened this issue Aug 29, 2016 · 0 comments
Open

Random error on init #55

lucianobarcaro opened this issue Aug 29, 2016 · 0 comments

Comments

@lucianobarcaro
Copy link

Hi, I'm trying to use this component, but, sometimes (really random - most of time, it works fine), when my app restarts, it gives me this error (gevent and asyncio, doesn't matter, tried both):

'AsyncioWebSocket' object has no attribute 'before_request_funcs' AttributeError("'AsyncioWebSocket' object has no attribute 'before_request_funcs'",)
  File "core/init/flask.py", line 74, in <module>
  File "/usr/lib64/python3.4/site-packages/flask/app.py", line 62, in wrapper_func
    return f(self, *args, **kwargs)
  File "/usr/lib64/python3.4/site-packages/flask_uwsgi_websocket/websocket.py", line 162, in register_blueprint
    blueprint.register(self, options, first_registration)
  File "/usr/lib64/python3.4/site-packages/flask/blueprints.py", line 153, in register
    deferred(state)
  File "/usr/lib64/python3.4/site-packages/flask/blueprints.py", line 128, in wrapper
    func(state)
  File "/usr/lib64/python3.4/site-packages/flask/blueprints.py", line 273, in <lambda>
    self.record_once(lambda s: s.app.before_request_funcs

The code I used to init websockets is:

WebSockets = None  # Just load websockets if really needed
if bp_websockets:
    try:
        from flask.ext.uwsgi_websocket import GeventWebSocket as Sockets
        WebSockets = Sockets(app)
        for bp, prefixo in bp_websockets:
            print(' Registrando o blueprint WebSocket', prefixo)
            # The error occurs in this line.
            WebSockets.register_blueprint(bp, url_prefix=prefixo)
    except exception as E:
        from traceback import format_tb
        from sys import exc_info
        print('*** Erro ao configurar websockets', E, repr(E))
        print(''.join(format_tb(exc_info()[2])))
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

1 participant