From dd38e0c8da059a20e846b0bb92cbf595d2a5c426 Mon Sep 17 00:00:00 2001 From: Ethan Dalool Date: Sat, 8 Feb 2020 15:51:45 -0800 Subject: [PATCH] Print a helpful message when bot.py or bot4.py isn't found. --- timesearch_modules/common.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/timesearch_modules/common.py b/timesearch_modules/common.py index f542236..aef1818 100644 --- a/timesearch_modules/common.py +++ b/timesearch_modules/common.py @@ -19,8 +19,15 @@ try: except ImportError: bot = None if bot is None or bot.praw != praw: - import bot4 - bot = bot4 + try: + import bot4 + bot = bot4 + except ImportError: + message = '\n'.join([ + 'Could not find your PRAW4 bot file as either `bot.py` or `bot4.py`.', + 'Please see the README.md file for instructions on how to prepare it.' + ]) + raise ImportError(message) logging.basicConfig()