``` bash
bot = ChatBot('new man')
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\engine\base.py", line 2147, in _wrap_pool_connect
return fn()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 387, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 516, in checkout
rec = pool._do_get()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 1229, in _do_get
return self._create_connection()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 333, in _create_connection
return _ConnectionRecord(self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 461, in __init__
self.__connect(first_connect_check=True)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 663, in __connect
pool.dispatch.connect(self.connection, self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\event\attr.py", line 218, in __call__
fn(args, *kw)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\chatterbot\storage\sql_storage.py", line 70, in set_sqlite_pragma
dbapi_connection.execute('PRAGMA journal_mode=WAL')
sqlite3.OperationalError: cannot change into wal mode from within a transaction
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "
bot = ChatBot('new man')
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\chatterbot\chatterbot.py", line 39, in __init__
self.storage = utils.initialize_class(storage_adapter, kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\chatterbot\utils.py", line 33, in initialize_class
return Class(kwargs)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\chatterbot\storage\sql_storage.py", line 77, in __init__
if not self.engine.dialect.has_table(self.engine, 'Statement'):
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 1181, in has_table
connection, "table_info", table_name, schema=schema)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 1572, in _get_table_pragma
cursor = connection.execute(statement)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\engine\base.py", line 2063, in execute
connection = self.contextual_connect(close_with_result=True)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\engine\base.py", line 2112, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\engine\base.py", line 2151, in _wrap_pool_connect
e, dialect, self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\engine\base.py", line 1465, in _handle_dbapi_exception_noconnection
exc_info
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\util\compat.py", line 203, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\util\compat.py", line 186, in reraise
raise value.with_traceback(tb)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\engine\base.py", line 2147, in _wrap_pool_connect
return fn()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 387, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 766, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 516, in checkout
rec = pool._do_get()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 1229, in _do_get
return self._create_connection()
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 333, in _create_connection
return _ConnectionRecord(self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 461, in __init__
self.__connect(first_connect_check=True)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\pool.py", line 663, in __connect
pool.dispatch.connect(self.connection, self)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\sqlalchemy\event\attr.py", line 218, in __call__
fn(args, *kw)
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python36-32\lib\site-packages\chatterbot\storage\sql_storage.py", line 70, in set_sqlite_pragma
dbapi_connection.execute('PRAGMA journal_mode=WAL')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) cannot change into wal mode from within a transaction
bot = ChatBot('new man')
after this states
(sqlite3.OperationalError) cannot change into wal mode from within a transaction
````
the python version is 3.6.0 I don't know whether affect it
I'm facing the same problem and have searched for hours. But I can't solve it, still
@chamkank Thank you. That might prove helpful in tracking down the cause.
I am trapped in this problem in a virtualenv environment, while it can run without error with macos system python3.
@chamkank How to install ver. 0.7.4? I am facing this issue in latest ver 0.8.7 of chatterbot
@mohitatgithub pip install --upgrade chatterbot==0.7.4
I'm going to close this ticket off. ChatterBot's SQL Storage adapter now has relatively proficient test coverage and I believe the issue that had caused this error has been fixed.
@gunthercox the issue is still there.. I just needed to downgrade to v, 0.7.4 to make the library work.
@giovannipiccinelli Can you post any steps or instructions that I can use to recreate this error?
I am using pythonanywhere python 3.6 and the error thrown looks similar to the one posted by Feekee at the top.
The ChatBot object does not get initialized for some reasons. Amazing library by the way 馃憤

i too had the same issue, downgrading it to 0.7.4 solved the issue.
I am running the following code with latest version and encountered the same problem.
from chatterbot.trainers import ListTrainer
from chatterbot import ChatBot
chatbot = ChatBot("Ron Obvious",
storage_adapter='chatterbot.storage.SQLStorageAdapter',
database_uri='sqlite:///database.sqlite3'
)
conversation = [
"Hello",
"Hi there!",
"How are you doing?",
"I'm doing great.",
"That is good to hear",
"Thank you.",
"You're welcome."
]
trainer = ListTrainer(chatbot)
trainer.train(conversation)
response = chatbot.get_response("good morning")
print(response)
So downloaded to 0.7.4 version as per the comments. Now I get the following error:
Traceback (most recent call last):
File "/Users/Prasanna/PycharmProjects/VMesgBot/sandbox/samples.py", line 17, in
trainer.train(conversation)
File "/Users/Prasanna/Environments/NLP_AI/lib/python3.6/site-packages/chatterbot/trainers.py", line 83, in train
statement = self.get_or_create(text)
File "/Users/Prasanna/Environments/NLP_AI/lib/python3.6/site-packages/chatterbot/trainers.py", line 27, in get_or_create
statement = self.storage.find(statement_text)
AttributeError: 'ChatBot' object has no attribute 'find'
So I updated chatbot to latest version and changed the sqladapter to mongodb. Everything works fine. I think the problem is with sqlite.
1.0.2
Traceback (most recent call last):
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 2228, in _wrap_pool_connect
return fn()
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 434, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 831, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 563, in checkout
rec = pool._do_get()
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 1355, in _do_get
return self._create_connection()
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 379, in _create_connection
return _ConnectionRecord(self)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 508, in __init__
self.__connect(first_connect_check=True)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 722, in __connect
pool.dispatch.connect(self.connection, self)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\event\attr.py", line 259, in __call__
fn(args, *kw)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\storage\sql_storage.py", line 43, in set_sqlite_pragma
dbapi_connection.execute('PRAGMA journal_mode=WAL')
sqlite3.OperationalError: cannot change into wal mode from within a transaction
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "d:\program files (x86)\microsoft visual studio\2019\preview\common7\ide\extensions\microsoft\python\core\ptvsd_launcher.py", line 119, in
vspd.debug(filename, port_num, debug_id, debug_options, run_as)
File "d:\program files (x86)\microsoft visual studio\2019\preview\common7\ide\extensions\microsoft\python\core\Packages\ptvsd\debugger.py", line 39, in debug
run()
File "d:\program files (x86)\microsoft visual studio\2019\preview\common7\ide\extensions\microsoft\python\core\Packages\ptvsd__main__.py", line 316, in run_file
runpy.run_path(target, run_name='__main__')
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 263, in run_path
pkg_name=pkg_name, script_name=fname)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 96, in _run_module_code
mod_name, mod_spec, pkg_name, script_name)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "G:\Demo\Python\ChatterBotDemo1\ChatterBotDemo1\ChatterBotDemo1.py", line 3, in
chatbot = ChatBot("Ron Obvious")
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\chatterbot.py", line 34, in __init__
self.storage = utils.initialize_class(storage_adapter, *kwargs)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\utils.py", line 47, in initialize_class
return Class(args, *kwargs)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\storage\sql_storage.py", line 46, in __init__
if not self.engine.dialect.has_table(self.engine, 'Statement'):
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 1357, in has_table
connection, "table_info", table_name, schema=schema
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\dialects\sqlite\base.py", line 1799, in _get_table_pragma
cursor = connection.execute(statement)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 2143, in execute
connection = self.contextual_connect(close_with_result=True)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 2192, in contextual_connect
self._wrap_pool_connect(self.pool.connect, None),
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 2232, in _wrap_pool_connect
e, dialect, self
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 1528, in _handle_dbapi_exception_noconnection
util.raise_from_cause(sqlalchemy_exception, exc_info)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\util\compat.py", line 296, in raise_from_cause
reraise(type(exception), exception, tb=exc_tb, cause=cause)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\util\compat.py", line 276, in reraise
raise value.with_traceback(tb)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\engine\base.py", line 2228, in _wrap_pool_connect
return fn()
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 434, in connect
return _ConnectionFairy._checkout(self)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 831, in _checkout
fairy = _ConnectionRecord.checkout(pool)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 563, in checkout
rec = pool._do_get()
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 1355, in _do_get
return self._create_connection()
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 379, in _create_connection
return _ConnectionRecord(self)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 508, in __init__
self.__connect(first_connect_check=True)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\pool.py", line 722, in __connect
pool.dispatch.connect(self.connection, self)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\sqlalchemy\event\attr.py", line 259, in __call__
fn(args, **kw)
File "C:\Users\qcjxb\AppData\Local\Programs\Python\Python36\lib\site-packages\chatterbot\storage\sql_storage.py", line 43, in set_sqlite_pragma
dbapi_connection.execute('PRAGMA journal_mode=WAL')
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) cannot change into wal mode from within a transaction (Background on this error at: http://sqlalche.me/e/e3q8)
I am trying to implement a chatterbot chatbot (corpus trainer) and having same issue. So I had to install chatterbot version 0.7.4 but then I got an "Attribute error", it says ChatBot has no attribute 'find'. I search many places and found that I need to increase the version of chatterbot. I update it to 1.0.2 but again I'm getting this error. :") Any suggestion?
ChatterBot 0.74 works fine!!!
Most helpful comment
@mohitatgithub
pip install --upgrade chatterbot==0.7.4