简体   繁体   中英

error when importing jwcrypto in python2.7

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?

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

  • pip install jwcrypto==0.9.1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM