Skip to content

UnicodeDecodeError: 'ascii' codec can't decode byte #215

@OlegZv

Description

@OlegZv

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions