error when importing jwcrypto in python2.7

863 views Asked by At

I am using jwcrypto in python2.7, and here comes a problem.

>>> import jwcrypto 
>>> from jwcrypto import jwk, jws
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\Lsq\.conda\envs\py27\lib\site-packages\jwcrypto\jwk.py", line 318
    raise InvalidJWKType(kty) from e
                                 ^
SyntaxError: invalid syntax

I am not familiar with python2.7, and it seems like it is not allowed to use raise from in python2.7.

However, in jwk.py i found several raise from which cause the error above. I installed python2.7 via conda create -n py27 python=2.7, and installed jwcrypto via pip install jwcrypto.

Does anyone know how may this problem be solved?

1

There are 1 answers

0
Raj Patel On

Uninstall 1.0 version and install 0.9.1 version for jwcrypto in python 2.7.

  • pip install jwcrypto==0.9.1