From 3b6482cb0ab7eb51756213ccf7b7c8822fbda3d5 Mon Sep 17 00:00:00 2001 From: Navan Chauhan Date: Tue, 7 Jul 2020 12:40:28 +0530 Subject: Fixed 10 Anti-Pattern issues --- app/run_docking.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'app/run_docking.py') diff --git a/app/run_docking.py b/app/run_docking.py index 02e8704..1b86d92 100644 --- a/app/run_docking.py +++ b/app/run_docking.py @@ -8,7 +8,7 @@ mycursor.execute(sql_select_Query) records = mycursor.fetchall() -def email(zi): +def email(zipArchive): import smtplib from email.mime.multipart import MIMEMultipart from email.mime.text import MIMEText @@ -26,9 +26,9 @@ def email(zi): msg.attach(MIMEText(body, 'plain')) filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip" - attachment = open((str(zi) + ".zip"), "rb") p = MIMEBase('application', 'octet-stream') - p.set_payload((attachment).read()) + with open((str(zipArchive) + ".zip"), "rb") as attachment: + p.set_payload((attachment).read()) encoders.encode_base64(p) p.add_header('Content-Disposition', "attachment; filename= %s" % filename) msg.attach(p) -- cgit v1.2.3