From 06faf9109400bdccad6fb7bc1767c4d280c1bd57 Mon Sep 17 00:00:00 2001 From: Shengchen Kan Date: Fri, 13 Sep 2024 07:09:25 +0800 Subject: [PATCH] [send_report] Not error but warn if an attachment does not exist --- send_report.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/send_report.py b/send_report.py index 074e07d..8fe593f 100755 --- a/send_report.py +++ b/send_report.py @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -import os, smtplib, subprocess, mimetypes, socket +import os, smtplib, subprocess, mimetypes, socket, sys import pandas as pd @@ -56,7 +56,9 @@ def main(): # Add attachments for attachment in args.attachments: - assert os.path.isfile(attachment), f'{attachment} is not a file' + if not os.path.isfile(attachment): + print(f'warning: {attachment} is not a file', file=sys.stderr) + continue add_attachment(msg, attachment) all_body_content = ''