From d6372671bec3f9f7212add424873d03c43c34cd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Ml=C3=A1dek?= Date: Wed, 29 May 2019 10:25:15 +0200 Subject: [PATCH] warning about missing markov; returns '???' when generation failed --- delojza.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/delojza.py b/delojza.py index 7e0a3f0..3a96e47 100755 --- a/delojza.py +++ b/delojza.py @@ -507,7 +507,7 @@ class MarkovBlabberer: self.logger.info("Sentence of the day: " + self.make_sentence()) def make_sentence(self, tries=100): - return self.markov.make_sentence(tries=tries) + return self.markov.make_sentence(tries=tries) or "???" def add_to_corpus(self, text): text = text.lower() @@ -536,6 +536,7 @@ if __name__ == '__main__': try: markov = MarkovBlabberer("initial.txt") except FileNotFoundError: + logging.warning("Didn't find `initial.txt`, continuing without markov blabbering!") markov = None delojza = DelojzaBot(config.get('delojza', 'tg_api_key'),