I've searched and tried most ideas on here about solving this, and I just don't know whats going on.
Class
class Posts:
def __init__(self):
self.connection = sqlite3.connect('C:/Users/mattv/Desktop/Scripts/simpsons-gpt2/comments.sqlite3')
self.cursor = self.connection.cursor()
def get(self, id):
self.cursor.execute("SELECT * FROM comments where id='%s'" % id)
row = self.cursor.fetchone()
return row
def add(self, id):
try:
self.cursor.execute("INSERT INTO comments VALUES('%s')" % id)
lid = self.cursor.lastrowid
self.connection.commit()
return lid
except sqlite3.IntegrityError:
return False
Error
File "c:/Users/mattv/Desktop/Scripts/simpsons-gpt2/comment_check.py", line 124, in get
self.cursor.execute("SELECT * FROM database where id='%s'" % id)
sqlite3.OperationalError: no such table: database
The sqlite3 is definitely in the same folder as comment_check.py and I can see it in the opened folder of VSCode
Can anyone help?