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

Connection lost in pymysql #173

Open
artyomLisovskij opened this issue Dec 20, 2018 · 0 comments
Open

Connection lost in pymysql #173

artyomLisovskij opened this issue Dec 20, 2018 · 0 comments

Comments

@artyomLisovskij
Copy link

artyomLisovskij commented Dec 20, 2018

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2309, in __call__
    return self.wsgi_app(environ, start_response)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2295, in wsgi_app
    response = self.handle_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1741, in handle_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2292, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1815, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1718, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/dist-packages/flask/_compat.py", line 35, in reraise
    raise value
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 1811, in full_dispatch_request
    rv = self.preprocess_request()
  File "/usr/local/lib/python3.6/dist-packages/flask/app.py", line 2087, in preprocess_request
    rv = func()
  File "/usr/local/lib/python3.6/dist-packages/flask_principal.py", line 477, in _on_before_request
    identity = loader()
  File "/usr/local/lib/python3.6/dist-packages/flask_security/core.py", line 245, in _identity_loader
    if not isinstance(current_user._get_current_object(), AnonymousUserMixin):
  File "/usr/local/lib/python3.6/dist-packages/werkzeug/local.py", line 306, in _get_current_object
    return self.__local()
  File "/usr/local/lib/python3.6/dist-packages/flask_login/utils.py", line 26, in <lambda>
    current_user = LocalProxy(lambda: _get_user())
  File "/usr/local/lib/python3.6/dist-packages/flask_login/utils.py", line 335, in _get_user
    current_app.login_manager._load_user()
  File "/usr/local/lib/python3.6/dist-packages/flask_login/login_manager.py", line 359, in _load_user
    return self.reload_user()
  File "/usr/local/lib/python3.6/dist-packages/flask_login/login_manager.py", line 321, in reload_user
    user = self.user_callback(user_id)
  File "/usr/local/lib/python3.6/dist-packages/flask_security/core.py", line 221, in _user_loader
    return _security.datastore.find_user(id=user_id)
  File "/usr/local/lib/python3.6/dist-packages/flask_security/datastore.py", line 366, in find_user
    return self.user_model.filter(**kwargs).get()
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 5911, in get
    return clone.execute(database)[0]
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 1587, in inner
    return method(self, database, *args, **kwargs)
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 1658, in execute
    return self._execute(database)
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 1809, in _execute
    cursor = database.execute(self)
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2666, in execute
    return self.execute_sql(sql, params, commit=commit)
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2660, in execute_sql
    self.commit()
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2451, in __exit__
    reraise(new_type, new_type(*exc_args), traceback)
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 178, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/peewee.py", line 2653, in execute_sql
    cursor.execute(sql, params or ())
  File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 170, in execute
    result = self._query(query)
  File "/usr/local/lib/python3.6/dist-packages/pymysql/cursors.py", line 328, in _query
    conn.query(q)
  File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 515, in query
    self._execute_command(COMMAND.COM_QUERY, sql)
  File "/usr/local/lib/python3.6/dist-packages/pymysql/connections.py", line 745, in _execute_command
    raise err.InterfaceError("(0, '')")
peewee.InterfaceError: (0, '')

I understand that this isn't peewee problem(it's pymysql, okay), but how can i prevent this error when i use flask+peewee+mysql?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant