handle empty database
This commit is contained in:
parent
023056b5d5
commit
32fa2302aa
|
@ -26,10 +26,15 @@ def make_sentence(output):
|
||||||
for toot in toots: # TODO: find a more efficient way to do this
|
for toot in toots: # TODO: find a more efficient way to do this
|
||||||
toots_str += "\n{}".format(toot[0])
|
toots_str += "\n{}".format(toot[0])
|
||||||
model = nlt_fixed(toots_str)
|
model = nlt_fixed(toots_str)
|
||||||
toots_str = None
|
|
||||||
db.close()
|
db.close()
|
||||||
os.remove("toots-copy.db")
|
os.remove("toots-copy.db")
|
||||||
|
|
||||||
|
if toots_str.rstrip("\n") == "":
|
||||||
|
output.send("Database is empty! Try running main.py.")
|
||||||
|
return
|
||||||
|
|
||||||
|
toots_str = None
|
||||||
|
|
||||||
sentence = None
|
sentence = None
|
||||||
tries = 0
|
tries = 0
|
||||||
while sentence is None and tries < 10:
|
while sentence is None and tries < 10:
|
||||||
|
|
Loading…
Reference in New Issue