From e500cf705d1ce10314dcb98c502368e870380d38 Mon Sep 17 00:00:00 2001 From: Jess 3Jane Date: Tue, 20 Feb 2018 11:34:40 -0500 Subject: [PATCH] apparently markovify sometimes returns none? --- gen.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gen.py b/gen.py index a9e769f..90e7e9d 100644 --- a/gen.py +++ b/gen.py @@ -15,6 +15,10 @@ with open("corpus.txt") as fp: print("Running...") while True: print("tooting") - client.toot(model.make_sentence().replace(chr(31), "\n")) + # This is not the best long term fix tbh + sentance = None + while sentence is None: + sentence = model.make_sentence() + client.toot(sentence.replace(chr(31), "\n")) print("sleeping") time.sleep(60*60*3)