Search code examples
tornado

pycket error when starting tornado application - syntax


Using pycket,

app = tornado.web.Application([
       tornado.web.url(r'/(?P<uuid>.+)', ArticlePage),tornado.web.url(r'/signup', SignUpHandler),tornado.web.url(r'/login', LoginHandler) ,tornado.web.url(r'/makeacc', AccountCreationHandler),tornado.web.url(r'/logout', LogoutHandler) 
    ],**{
'pycket': {
    'engine': 'redis',
    'storage': {
        'host': 'localhost',
        'port': 6379,
        'db_sessions': 10,
        'db_notifications': 11,
        'max_connections': 2 ** 31,
    },
    'cookies': {
        'expires_days': 120,
    },
})

I try to just make the app, exactly the same way that is done on the main page under examples for redis https://github.com/diogobaeder/pycket.

and I get this error

  File "server.py", line 122
    })
     ^
SyntaxError: invalid syntax

Nothing looks wrong to me. Not sure what the issue is because I used the starting code exactly.

Thank you.


Solution

  • Missing one closing brace:

    app = tornado.web.Application([
        tornado.web.url(r'/(?P<uuid>.+)', ArticlePage),tornado.web.url(r'/signup', SignUpHandler),tornado.web.url(r'/login', LoginHandler) ,tornado.web.url(r'/makeacc', AccountCreationHandler),tornado.web.url(r'/logout', LogoutHandler)
    ],**{
    'pycket': {
        'engine': 'redis',
        'storage': {
            'host': 'localhost',
            'port': 6379,
            'db_sessions': 10,
            'db_notifications': 11,
            'max_connections': 2 ** 31,
        },
        'cookies': {
            'expires_days': 120,
        },
    }})
    

    Editors specialized for writing code, like Emacs, PyCharm, Komodo, Sublime, or any number of other code editors and IDEs, have features to make it obvious when you mismatch braces, parentheses, or brackets.