sqlite3出现问题,chatterbot中出现操作错误

x8diyxa7  于 2022-11-30  发布在  SQLite
关注(0)|答案(1)|浏览(129)

所以我想创建一个聊天机器人与chatterbot的机器人不和谐,但当我初始化机器人我得到了这个错误:

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)

我的准则是:

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

我正在使用ubuntu服务器LTS 20.04和python 3.8.5希望你能找到答案,我已经尝试删除所有的db.sqlite3文件,但同样的错误再次弹出

7qhs6swi

7qhs6swi1#

它的确定,我只是改变了访问权限,从当我正在执行代码,现在它的工作非常好

相关问题