VSCode: Не могу понять, как запустить болтун на терминале - PullRequest
0 голосов
/ 27 февраля 2020

Я получаю эту ошибку, когда пытаюсь запустить chatbot_train.py с помощью VSCode. Вот код и сообщение с терминала.

from chatterbot import ChatBot from chatterbot.trainers import
 ListTrainer import os

 bot = ChatBot('Bot') bot.set_trainer(ListTrainer)

 for files in os.listdir('D:/chatbot_project/data/english/'):
    data = open('D:/chatbot_project/data/english/' + files, 'r').readlines()
    bot.train(data)

 while True:
    message = input('You: ')
    if message.strip() != 'Bye':
        reply = bot.get_response(message)
        print('Chatbot: ', reply)
    if message.strip() == 'Bye':
        print('Chatbot: Bye')
        break
D:\chatbot_project>python chatbot_train.py Traceback (most recent call
 last):   File
 "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sit
    return fn()   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return _ConnectionFairy._checkout(self)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    fairy = _ConnectionRecord.checkout(pool)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    rec = pool._do_get()   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return self._create_connection()   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return _ConnectionRecord(self)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    self.__connect(first_connect_check=True)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    pool.dispatch.connect(self.connection, self)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    fn(*args, **kw)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sipragma
    dbapi_connection.execute('PRAGMA journal_mode=WAL') sqlite3.OperationalError: cannot change into wal mode from within a
 The above exception was the direct cause of the following exception
 Traceback (most recent call last):   File "chatbot_train.py", line 5,
 in <module>
    bot = ChatBot('Bot')   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    self.storage = utils.initialize_class(storage_adapter, **kwargs   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return Class(**kwargs)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    if not self.engine.dialect.has_table(self.engine, 'Statement'):   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sie
    connection, "table_info", table_name, schema=schema   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sile_pragma
    cursor = connection.execute(statement)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    connection = self.contextual_connect(close_with_result=True)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sit
    self._wrap_pool_connect(self.pool.connect, None),   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sit
    e, dialect, self   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sieption_noconnection
    util.raise_from_cause(sqlalchemy_exception, exc_info)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    reraise(type(exception), exception, tb=exc_tb, cause=cause)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    raise value.with_traceback(tb)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\sit
    return fn()   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return _ConnectionFairy._checkout(self)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    fairy = _ConnectionRecord.checkout(pool)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    rec = pool._do_get()   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return self._create_connection()   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    return _ConnectionRecord(self)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    self.__connect(first_connect_check=True)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si
    pool.dispatch.connect(self.connection, self)   File "C:\Users\user\AppData\Local\Programs\Python\Python36\lib\si   File
 "C:\Users\user\AppData\Local\Programs\Python\Python36\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 (Background on this
 error at: http://sqlalche.me/e/e3q8)
...