Flask-Session can't import want_bytes from itsdangerous

后端 未结 2 905
星月不相逢
星月不相逢 2021-01-25 16:19

I am using Flask-Session and recently installed or upgraded to itsdangerous 1.0.0. Now I get the error ImportError: cannot import name \'want_bytes\'. Why is this e

相关标签:
2条回答
  • 2021-01-25 17:02

    itsdangerous 1.1.0 contains a temporary fix for this. You can upgrade itsdangerous and continue to use Flask-Session right now. There is no need to pin to itsdangerous==0.24.


    itsdangerous 1.0.0 was recently released, removing non-public top-level imports. Flask-Session appears to have been using such an import, from itsdangerous import want_bytes.

    This has been reported to Flask-Session and a fix will hopefully be released eventually.

    0 讨论(0)
  • 2021-01-25 17:20

    The file structure of the itsdangerous package has changed. The function resides in the session.py file. Changing the import statements from:

    from itsdangerous import Signer, BadSignature, want_bytes
    

    to

    from itsdangerous import Signer, BadSignature
    from itsdangerous.encoding import want_bytes
    

    works for me.

    0 讨论(0)
提交回复
热议问题