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

Run into an error when typing chinese #1020

Closed
Pythonbotty opened this issue Oct 9, 2017 · 4 comments
Closed

Run into an error when typing chinese #1020

Pythonbotty opened this issue Oct 9, 2017 · 4 comments
Labels

Comments

@Pythonbotty
Copy link

Does anybody else run into the following error when trying to type chinese character into the chatbot?

sqlalchemy.exc.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 statement.id AS statement_id, statement.text AS statement_text, statement.extra_data AS statement_extra_data \nFROM statement \nWHERE statement.text = ?\n LIMIT ? OFFSET ?'] [parameters: ('\xe4\xbd\xa0\xe5\xa5\xbd\xe5\x90\x97', 1, 0)]

@gunthercox gunthercox added the bug label Oct 10, 2017
@gunthercox
Copy link
Owner

@Pythonbotty I haven't hit this error before but it sounds like a possible error with the Sqlite storage. I'll see what I can do to recreate this error and correct it.

@Pythonbotty
Copy link
Author

Thanks Gunther. These are my codes if it helps in any way. I just have to type a chinese character into it and the error will show up.

bot = ChatBot ("Charlie",trainer="chatterbot.trainers.ListTrainer", logic_adapters=[{
"import_path":"chatterbot.logic.BestMatch",
"statement_comparison_function":"chatterbot.comparisons.levenshtein_distance"}],response_selection_method=get_random_response,read_only=True)

import pandas as pd
export = pd.read_csv('Something.csv', header=None)
conversation = export.values.T[1].tolist()
results = export.values.T[0].tolist()
test = pd.DataFrame(conversation,results)

for ab in test.itertuples():

bot.train (ab)

logging.basicConfig(level=logging.INFO)

while True:
try:
sentence = raw_input (" ")
print bot.get_response(sentence)
except(KeyboardInterrupt,EOFError,SystemExit):
break

@Pythonbotty
Copy link
Author

These are my last 2 lines of errors.

File "C:\Users\USER\Anaconda\Lib\site-packages\sqlalchemy\engine\base.py", line 1182, in _execute_context
context)
File "C:\Users\USER\Anaconda\Lib\site-packages\sqlalchemy\engine\default.py", line 470, in do_execute
cursor.execute(statement, parameters)

@Pythonbotty
Copy link
Author

Thank you!

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

No branches or pull requests

2 participants