Kresten
Kresten

Reputation: 838

Flask-Security error: "ValueError: too many values to unpack"

I have setup a flask-security app, but I'm getting an error creating users and resetting passwords.

Traceback (most recent call last):
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1997, in __call__ 
  return self.wsgi_app(environ, start_response)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1985, in wsgi_app
  response = self.handle_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1540, in handle_exception
  reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1982, in wsgi_app
  response = self.full_dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1614, in full_dispatch_request
  rv = self.handle_user_exception(e)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1612, in full_dispatch_request
  rv = self.dispatch_request()
File "/usr/local/lib/python2.7/dist-packages/flask/app.py", line 1598, in dispatch_request
  return self.view_functions[rule.endpoint](**req.view_args)
File "/usr/local/lib/python2.7/dist-packages/flask_securit /decorators.py", line 230, in wrapper
  return f(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/flask_security/views.py", line 118, in register
  user = register_user(**form.to_dict())
File "/usr/local/lib/python2.7/dist-packages/flask_security/registerable.py", line 41, in register_user
  'welcome', user=user, confirmation_link=confirmation_link)
File "/usr/local/lib/python2.7/dist-packages/flask_security/utils.py", line 401, in send_mail
  mail.send(msg)
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 492, in send
  message.send(connection)
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 427, in send
  connection.send(self)
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 188, in send
  self.host.sendmail(sanitize_address(envelope_from or message.sender),
File "/usr/local/lib/python2.7/dist-packages/flask_mail.py", line 105, in sanitize_address
  nm, addr = addr

ValueError: too many values to unpack    ValueError: too many values to unpack

I just followed the guide from https://pythonhosted.org/Flask-Security/quickstart.html#basic-sqlalchemy-application

I need help finding out what is wrong.

Here is my e-mail config:

app.config['MAIL_SERVER'] = 'smtp.gmail.com'
app.config['MAIL_PORT'] = 465
app.config['MAIL_USE_SSL'] = True
app.config['MAIL_USERNAME'] = '[email protected]'
app.config['MAIL_PASSWORD'] = '**********'
app.config['MAIL_DEFAULT_SENDER'] = '[email protected]'
mail = Mail(app)

/Kresten

Upvotes: 0

Views: 1304

Answers (1)

Moses N. Njenga
Moses N. Njenga

Reputation: 771

This is a known issue with the send_mail method in flask-security utils ref this thread .

It is corrected in this branch

One way out is to uninstall flask-security and install the updated repo

pip install git+https://github.com/mattupstate/flask-security

Of course depending on your settings you may want to do sudo pip install

Upvotes: 5

Related Questions