Flask-User icon indicating copy to clipboard operation
Flask-User copied to clipboard

UnicodeDecodeError: 'ascii' codec can't decode byte

Open OlegZv opened this issue 7 years ago • 1 comments

In Flask-User 1.0.1.4(python 2.7) when starting an app, Flask-User throws an error:

Traceback (most recent call last):
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.3\helpers\pydev\pydevd.py", line 1599, in <module>
    globals = debugger.run(setup['file'], None, None, is_module)
  File "C:\Program Files\JetBrains\PyCharm Community Edition 2017.2.3\helpers\pydev\pydevd.py", line 1026, in run
    pydev_imports.execfile(file, globals, locals)  # execute the script
  File "C:/AutomatedTesting/run.py", line 1, in <module>
    from auto_device_testing import app
  File "C:/AutomatedTesting\auto_device_testing\__init__.py", line 11, in <module>
    from views import main
  File "C:/AutomatedTesting\auto_device_testing\views.py", line 10, in <module>
    user_manager = UserManager(app, db, User)
  File "C:\Users\ozvona413\AutomatedTesting\lib\site-packages\flask_user\user_manager.py", line 56, in __init__
    self.init_app(app, db, UserClass, **kwargs)
  File "C:\Users\ozvona413\AutomatedTesting\lib\site-packages\flask_user\user_manager.py", line 197, in init_app
    self.token_manager = TokenManager(app)
  File "C:\Users\ozvona413\AutomatedTesting\lib\site-packages\flask_user\token_manager.py", line 46, in __init__
    key = flask_secret_key.encode()
UnicodeDecodeError: 'ascii' codec can't decode byte 0x8c in position 2: ordinal not in range(128)

SEKRET_KEY="?A\x8c_\x0cX\xf2K%]J!i\x97\x84\xd2\xddb\x8d\x8a\xe7\x9b+\x1d"

Tried to change flask_secret_key.encode() to flask_secret_key.encode('utf-8') but it threw the save error.

OlegZv avatar May 31 '18 13:05 OlegZv

Looks relevant to https://github.com/lingthio/Flask-User/pull/229

and-semakin avatar Nov 24 '19 17:11 and-semakin