python-2.6flask-jwt

Getting an "invalid syntax" error from __init__.py


I'm following this example for using Flask-JWT:

https://pythonhosted.org/Flask-JWT/

And I get this error when I start uwsgi:


Traceback (most recent call last):
  File "./wsgi.py", line 1, in 
    from main import app as application
  File "./main.py", line 5, in 
    from auth import api_auth
  File "./auth.py", line 3, in 
    from flask_jwt import JWT
  File "/opt/mist_base/env/lib/python2.6/site-packages/flask_jwt/__init__.py", line 83
    for claim in verify_claims
      ^
SyntaxError: invalid syntax

I've been only using Python v2.6.6 (for Centos 6.x per customer specification) for only a week so I'm still very green at it. As a result, earlier today I discovered I had multiple variations of JWT-something in my virtualenv so I removed all instances and only reinstalled Flask-JWT. I had thought the issue was library conflicts (and it may have been earlier), but I'm still getting this error and other people have used it with no issues. Am I doing something wrong or is this library simply not designed to be used with Python v2.6.x?

[UPDATE] I've gone ahead and compiled v2.7.12 from source in CentOS 6 and so far it works nicely for my needs. I found these directions:

http://toomuchdata.com/2014/02/16/how-to-install-python-on-centos/

and was able to install in an alternate directory.


Solution

  • This library just doesn't work on Python 2.6. The source code relies on features like dict comprehensions that only exist in 2.7 and up.