Skip to content

Commit

Permalink
[send_report] Not error but warn if an attachment does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
KanRobert committed Sep 12, 2024
1 parent 02cd8e1 commit 06faf91
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions send_report.py
Original file line number Diff line number Diff line change
@@ -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


Expand Down Expand Up @@ -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 = ''
Expand Down

0 comments on commit 06faf91

Please sign in to comment.