From caa2fff26c959e7ed290e165923bdad7e3443647 Mon Sep 17 00:00:00 2001 From: Stefano Pigozzi Date: Thu, 9 Jan 2020 03:34:27 +0100 Subject: [PATCH] fix bug and slip --- royalpack/commands/markov.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/royalpack/commands/markov.py b/royalpack/commands/markov.py index f0db40d3..d4d5babf 100644 --- a/royalpack/commands/markov.py +++ b/royalpack/commands/markov.py @@ -19,6 +19,8 @@ class MarkovCommand(Command): files: List[str] = tuple(os.walk(self.config["Markov"]["models_directory"]))[0][2] for file in files: match = re.match("(\S+)\.json", file) + if match is None: + continue model_name = match.group(1) with open(os.path.join(self.config["Markov"]["models_directory"], file)) as f: self._texts[model_name] = markovify.NewlineText.from_json(f.read())