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

Error when sending emojis or accents #3

Open
edhelas opened this issue Jul 27, 2017 · 1 comment
Open

Error when sending emojis or accents #3

edhelas opened this issue Jul 27, 2017 · 1 comment
Labels

Comments

@edhelas
Copy link

edhelas commented Jul 27, 2017

An error is thrown when messages including emojis or accents are sent.

2017-07-27 22:18:54,196 INFO     chatterbot.adapters: Recieved input statement: hey 😇
2017-07-27 22:18:54,208 ERROR    ludolph_chatbot.chatterbot: (sqlite3.ProgrammingError) You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. [SQL: u'SELECT "StatementTable".id AS "StatementTable_id", "StatementTable".text AS "StatementTable_text", "StatementTable".extra_data AS "StatementTable_extra_data" \nFROM "StatementTable" \nWHERE "StatementTable".text = ?\n LIMIT ? OFFSET ?'] [parameters: ('hey \xf0\x9f\x98\x87', 1, 0)]
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/ludolph_chatbot/chatterbot.py", line 79, in _command_not_found
    res = self.chatbot.get_response(txt)
  File "/usr/local/lib/python2.7/dist-packages/chatterbot/chatterbot.py", line 103, in get_response
    input_statement = self.input.process_input_statement(input_item)
  File "/usr/local/lib/python2.7/dist-packages/chatterbot/input/input_adapter.py", line 24, in process_input_statement
    existing_statement = self.chatbot.storage.find(input_statement.text)
  File "/usr/local/lib/python2.7/dist-packages/chatterbot/storage/sql_storage.py", line 154, in find
    record = query.first()
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2755, in first
    ret = list(self[0:1])
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2547, in __getitem__
    return list(res)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2855, in __iter__
    return self._execute_and_instances(context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/orm/query.py", line 2878, in _execute_and_instances
    result = conn.execute(querycontext.statement, self._params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 945, in execute
    return meth(self, multiparams, params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/sql/elements.py", line 263, in _execute_on_connection
    return connection._execute_clauseelement(self, multiparams, params)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1053, in _execute_clauseelement
    compiled_sql, distilled_params
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1189, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1402, in _handle_dbapi_exception
    exc_info
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/base.py", line 1182, in _execute_context
    context)
  File "/usr/local/lib/python2.7/dist-packages/sqlalchemy/engine/default.py", line 470, in do_execute
    cursor.execute(statement, parameters)
ProgrammingError: (sqlite3.ProgrammingError) You must not use 8-bit bytestrings unless you use a text_factory that can interpret 8-bit bytestrings (like text_factory = str). It is highly recommended that you instead just switch your application to Unicode strings. [SQL: u'SELECT "StatementTable".id AS "StatementTable_id", "StatementTable".text AS "StatementTable_text", "StatementTable".extra_data AS "StatementTable_extra_data" \nFROM "StatementTable" \nWHERE "StatementTable".text = ?\n LIMIT ? OFFSET ?'] [parameters: ('hey \xf0\x9f\x98\x87', 1, 0)]
@dn0 dn0 added the bug label Aug 3, 2017
@dn0
Copy link
Member

dn0 commented Aug 3, 2017

Definitely a bug, but cannot reproduce in python 3.6, only in python 2.7.

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

No branches or pull requests

2 participants