-2

So i want to create a chatbot with chatterbot for a bot on discord but when i initialize the bot ive got this error :

  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
    return fn()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 403, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 782, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 532, in checkout
    rec = pool._do_get()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 1277, in _do_get
    return self._create_connection()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 350, in _create_connection
    return _ConnectionRecord(self)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 477, in __init__
    self.__connect(first_connect_check=True)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 667, in __connect
    connection = pool._invoke_creator(self)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 410, in connect
    return self.dbapi.connect(*cargs, **cparams)
sqlite3.OperationalError: unable to open database file

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/ubuntu/.local/lib/python3.8/site-packages/chatterbot/chatterbot.py", line 43, in __init__
    self.storage = utils.initialize_class(storage_adapter, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/chatterbot/utils.py", line 33, in initialize_class
    return Class(*args, **kwargs)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/chatterbot/storage/sql_storage.py", line 63, in __init__
    if not self.engine.dialect.has_table(self.engine, 'Statement'):
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 1180, in has_table
    info = self._get_table_pragma(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/dialects/sqlite/base.py", line 1572, in _get_table_pragma
    cursor = connection.execute(statement)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2074, in execute
    connection = self.contextual_connect(close_with_result=True)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2123, in contextual_connect
    self._wrap_pool_connect(self.pool.connect, None),
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2161, in _wrap_pool_connect
    Connection._handle_dbapi_exception_noconnection(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 1474, in _handle_dbapi_exception_noconnection
    util.raise_from_cause(
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 203, in raise_from_cause
    reraise(type(exception), exception, tb=exc_tb, cause=cause)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/util/compat.py", line 186, in reraise
    raise value.with_traceback(tb)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/base.py", line 2158, in _wrap_pool_connect
    return fn()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 403, in connect
    return _ConnectionFairy._checkout(self)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 782, in _checkout
    fairy = _ConnectionRecord.checkout(pool)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 532, in checkout
    rec = pool._do_get()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 1277, in _do_get
    return self._create_connection()
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 350, in _create_connection
    return _ConnectionRecord(self)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 477, in __init__
    self.__connect(first_connect_check=True)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/pool.py", line 667, in __connect
    connection = pool._invoke_creator(self)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/strategies.py", line 105, in connect
    return dialect.connect(*cargs, **cparams)
  File "/home/ubuntu/.local/lib/python3.8/site-packages/sqlalchemy/engine/default.py", line 410, in connect
    return self.dbapi.connect(*cargs, **cparams)
sqlalchemy.exc.OperationalError: (sqlite3.OperationalError) unable to open database file (Background on this error at: http://sqlalche.me/e/e3q8)

My code is that :

from chatterbot import ChatBot
from chatterbot.trainers import ChatterBotCorpusTrainer
chatbot = ChatBot('Didier')

I'm using ubuntu server LTS 20.04 and python 3.8.5 Hope you find an answer to that I already tried to remove all the db.sqlite3 files but the same error pops again

Lasauce6
  • 1
  • 1

1 Answers1

-1

Its ok ive just changed the acces rights from when i was executing the code and now its working very well

Lasauce6
  • 1
  • 1
  • Have you more explanations ? I have the exact same problem with only 1 of my Chabot and I compare right : they are exactly the same for my sqlites which work than with sqlite which doesn't – LucieDevGirl Nov 29 '22 at 16:43