bots: zulip_bot_output.py: Check for failed bot module import.

This commit is contained in:
neiljp (Neil Pilgrim) 2017-10-02 13:49:20 -07:00 committed by Tim Abbott
parent dd283d88f6
commit 8e9c6cd22e

View file

@ -61,7 +61,11 @@ def main():
bot_dir = os.path.dirname(bot_path) bot_dir = os.path.dirname(bot_path)
if args.provision: if args.provision:
provision_bot(os.path.dirname(bot_path), args.force) provision_bot(os.path.dirname(bot_path), args.force)
try:
lib_module = import_module_from_source(bot_path, bot_name) lib_module = import_module_from_source(bot_path, bot_name)
except IOError:
print("Could not find and import bot '{}'".format(bot_name))
sys.exit(1)
message = {'content': args.message, 'sender_email': 'foo_sender@zulip.com'} message = {'content': args.message, 'sender_email': 'foo_sender@zulip.com'}
message_handler = lib_module.handler_class() message_handler = lib_module.handler_class()