Я создавал чат-бота, который отлично работал на моем локальном ПК, а также на веб-сервере Amazon, но я хочу реализовать этот чат-робот на сервере Digital Ocean, поскольку мой веб-сайт работает на сервере Digital Ocean. Я получаю эти ошибки Sqlite
[pythondemo@panel Chatbot]$ python3.6 chatbot.py
Traceback (most recent call last):
File "chatbot.py", line 8, in <module>
from sqlite3 import dbapi2 as sqlite
File "/home/pythondemo/.local/lib/python3.6/sqlite3/__init__.py", line 23, in <module>
from sqlite3.dbapi2 import *
File "/home/pythondemo/.local/lib/python3.6/sqlite3/dbapi2.py", line 50, in <module>
version_info = tuple([int(x) for x in version.split(".")])
NameError: name 'version' is not defined
Это код, который я пытаюсь запустить:
import os
import sys
import datetime
from chatterbot import ChatBot
from chatterbot.trainers import ListTrainer
import random
from sqlite3 import dbapi2 as sqlite
bot = ChatBot('Bot')
bot.set_trainer(ListTrainer)
for files in os.listdir('C:/Users/OMI/Desktop/chatterbot-corpus-master/chatterbot_corpus/data/english/'):
data = open('C:/Users/OMI/Desktop/chatterbot-corpus-master/chatterbot_corpus/data/english/' + files, 'r').readlines()
bot.train(data)
t=datetime.datetime.now().hour
start_greeting = ('hello', 'hi', 'welcome', 'hey')
end_greeting = ('bye', 'cya', 'goodbye')
random_start_greeting = random.choice(start_greeting)
random_end_greeting = random.choice(end_greeting)
message = ' '.join(word for word in sys.argv)
message = message.replace("chatbot.py ","")
if message.strip() in start_greeting:
reply = random_start_greeting
print(reply.strip())
if (t <= 12 and t >= 5):
print("Welcome! Good Morning.")
elif (t < 17 and t > 12):
print("Welcome! Good Afternoon.")
elif (t < 20 and t >= 17):
print("Welcome! Good Evening.")
elif (t < 23 and t >= 20):
print("Welcome! Hope you had a great day.")
elif message.strip() in end_greeting:
reply = random_end_greeting
print(reply)
else:
reply = bot.get_response(message)
print("hello")