1
 from chatterbot import ChatBot
 bot = ChatBot("The Royal Zhao")

gives the error

  File "/Users/michaelchary/Documents/GitHub/yalebot/flaskbot.py", line 8, in <module>
    bot = ChatBot("The Royal Zhao")
  File "/usr/local/lib/python3.9/site-packages/ChatterBot-1.1.0a7-py3.9.egg/chatterbot/chatterbot.py", line 28, in __init__
  File "/usr/local/lib/python3.9/site-packages/ChatterBot-1.1.0a7-py3.9.egg/chatterbot/utils.py", line 33, in initialize_class
  File "/usr/local/lib/python3.9/site-packages/ChatterBot-1.1.0a7-py3.9.egg/chatterbot/storage/sql_storage.py", line 46, in __init__
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/dialects/sqlite/base.py", line 2009, in has_table
    self._ensure_has_table_connection(connection)
  File "/usr/local/lib/python3.9/site-packages/sqlalchemy/engine/default.py", line 341, in _ensure_has_table_connection
    raise exc.ArgumentError(
sqlalchemy.exc.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.

I installed chatterbot (v1.1) and chatterbot-corpus (v1.2.0) by cloning the repository because of incompatibilities between PyYAML, Spacy, Python 3.9.1 (my version).

I have SQL Alchemcy v1.4.13.

My os is 10.15.7 (Mac, Catalina).

The error doesn't change if I have started the SQL server (via brew services start mysql) or not. The content of the text string has no impact (e.g., spaces or underscores don't matter).

I couldn't reports of this error online. This doesn't seem to be a common error when installing chatterbot.

Update There is no error with MongoDatabaseAdapter, suggesting the issue is the link between SQL and chatterbot.

mac389
  • 3,004
  • 5
  • 38
  • 62

3 Answers3

1

I was able to resolve this issue by using Python 3.7.3 (released March 2019), rather than Python 3.9.

Nix White
  • 21
  • 2
0

I presume somewhere in ChatterBot uses engine.dialect.has_table(engine, <tablename>), which seems to be depreciated.

Need to ask ChatterBot developers to change that to inspect(engine).has_table(<tablename>)

BookSword
  • 328
  • 1
  • 6
0

I have faced same issue. when i did !pip3 install SQLAlchemy==1.3.6 and !pip3 install Mako==1.1.2 it resolved all the issues.