From 4b8798ddea9ae453ed8f8c4ffa5f024f1380a9a1 Mon Sep 17 00:00:00 2001 From: b3yond Date: Fri, 11 Jan 2019 14:52:58 +0100 Subject: [PATCH] fixing shutdown when exim4 is not set up --- active_bots/mailbot.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/active_bots/mailbot.py b/active_bots/mailbot.py index 7c8fcb5..984d09f 100644 --- a/active_bots/mailbot.py +++ b/active_bots/mailbot.py @@ -19,7 +19,11 @@ class Mailbot(Bot): def crawl(self, user): reports = [] # todo: adjust to actual mailbox - mails = mailbox.mbox("/var/mail/" + config['mail']['mbox_user']) + try: + mails = mailbox.mbox("/var/mail/" + config['mail']['mbox_user']) + except FileNotFoundError: + logger.error("No mbox file found.", exc_info=True) + return reports for msg in mails: if get_date_from_header(msg['Date']) > user.get_seen_mail(): if user.get_city().lower() in msg['To'].lower():