Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: key: expected bytes or bytearray, but got 'tuple' #93

Closed
ndeoligence opened this issue Nov 1, 2020 · 2 comments · Fixed by #91
Closed

TypeError: key: expected bytes or bytearray, but got 'tuple' #93

ndeoligence opened this issue Nov 1, 2020 · 2 comments · Fixed by #91
Labels
bug Something isn't working good first issue Good for newcomers

Comments

@ndeoligence
Copy link
Contributor

ndeoligence commented Nov 1, 2020

Issue:
Run the flask app (web/)
Click on the given link (http://127.0.0.1:5000) to access the app

Expected: Should show the img-upload page
Actual: Gives an error with this as part of the stacktrace (Only external files are shown in the stacktrace):

127.0.0.1 - - [01/Nov/2020 15:06:37] "GET / HTTP/1.1" 500 -
Traceback (most recent call last):
  File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 2464, in __call__
    return self.wsgi_app(environ, start_response)
  File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 2450, in wsgi_app
    response = self.handle_exception(e)
  File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 1867, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "ascii-art/venv/lib/python3.8/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "ascii-art/venv/lib/python3.8/site-packages/flask/app.py", line 2446, in wsgi_app
    ctx.push()
  File "ascii-art/venv/lib/python3.8/site-packages/flask/ctx.py", line 390, in push
    self.session = session_interface.open_session(self.app, self.request)
  File "ascii-art/venv/lib/python3.8/site-packages/flask/sessions.py", line 348, in open_session
    data = s.loads(val, max_age=max_age)
  File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/timed.py", line 130, in loads
    base64d, timestamp = signer.unsign(s, max_age, return_timestamp=True)
  File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/timed.py", line 52, in unsign
    result = Signer.unsign(self, value)
  File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/signer.py", line 167, in unsign
    if self.verify_signature(value, sig):
  File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/signer.py", line 153, in verify_signature
    key = self.derive_key()
  File "ascii-art/venv/lib/python3.8/site-packages/itsdangerous/signer.py", line 132, in derive_key
    mac = hmac.new(self.secret_key, digestmod=self.digest_method)
  File "/usr/lib/python3.8/hmac.py", line 153, in new
    return HMAC(key, msg, digestmod)
  File "/usr/lib/python3.8/hmac.py", line 48, in __init__
    raise TypeError("key: expected bytes or bytearray, but got %r" % type(key).__name__)
@ndeoligence ndeoligence added bug Something isn't working good first issue Good for newcomers labels Nov 1, 2020
@ndeoligence
Copy link
Contributor Author

Solution: Remove the trailing comma from config.py:27

  SECRET_KEY = 'devlopment_key',

@rpdavila
Copy link
Contributor

rpdavila commented Nov 3, 2020

just fixed all of it

@ndeoligence ndeoligence linked a pull request Nov 3, 2020 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants