Getting ArgumentError when trying to instantiate ChatBot

Viewed 31

Getting Below Error

from chatterbot import ChatBot from chatterbot.trainers import ChatterBotCorpusTrainer

 chatbot=ChatBot('Kunal Bot')

Error:

ArgumentError                             Traceback (most recent call last)
Untitled-1.ipynb Cell 1 in <cell line: 5>()
      1 from chatterbot import ChatBot
      2 from chatterbot.trainers import ChatterBotCorpusTrainer
----> 5 chatbot=ChatBot('Kunal Bot')
File C:\ProgramData\Anaconda3\lib\site-packages\chatterbot\chatterbot.py:34, in ChatBot.__init__(self, name, **kwargs)
     31 # Logic adapters used by the chat bot
     32 self.logic_adapters = []
---> 34 self.storage = utils.initialize_class(storage_adapter, **kwargs)
     36 for adapter in logic_adapters:
     37     utils.validate_adapter_class(adapter, LogicAdapter)

File C:\ProgramData\Anaconda3\lib\site-packages\chatterbot\utils.py:54, in initialize_class(data, *args, **kwargs)
     51 else:
     52     Class = import_module(data)
---> 54     return Class(*args, **kwargs)

File C:\ProgramData\Anaconda3\lib\site-packages\chatterbot\storage\sql_storage.py:46, in SQLStorageAdapter.__init__(self, **kwargs)
     43         dbapi_connection.execute('PRAGMA journal_mode=WAL')
     44         dbapi_connection.execute('PRAGMA synchronous=NORMAL')
---> 46 if not self.engine.dialect.has_table(self.engine, 'Statement'):
     47     self.create_database()
     49 self.Session = sessionmaker(bind=self.engine, expire_on_commit=True)

File C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\dialects\sqlite\base.py:2016, in SQLiteDialect.has_table(self, connection, table_name, schema)
   2015 def has_table(self, connection, table_name, schema=None):
-> 2016     self._ensure_has_table_connection(connection)
   2018     info = self._get_table_pragma(
   2019         connection, "table_info", table_name, schema=schema
   2020     )
   2021     return bool(info)

File C:\ProgramData\Anaconda3\lib\site-packages\sqlalchemy\engine\default.py:341, in DefaultDialect._ensure_has_table_connection(self, arg)
    338 def _ensure_has_table_connection(self, arg):
    340     if not isinstance(arg, Connection):
--> 341         raise exc.ArgumentError(
    342             "The argument passed to Dialect.has_table() should be a "
    343             "%s, got %s. "
    344             "Additionally, the Dialect.has_table() method is for "
    345             "internal dialect "
    346             "use only; please use "
    347             "``inspect(some_engine).has_table(<tablename>>)`` "
    348             "for public API use." % (Connection, type(arg))
    349         )

ArgumentError: The argument passed to Dialect.has_table() should be a <class 'sqlalchemy.engine.base.Connection'>, got <class 'sqlalchemy.engine.base.Engine'>. Additionally, the Dialect.has_table() method is for internal dialect use only; please use ``inspect(some_engine).has_table(<tablename>>)`` for public API use.
0 Answers
Related