fix file open anti-pattern
This commit is contained in:
parent
6a67fd7e8b
commit
59e56bb76e
|
@ -26,8 +26,8 @@ def email(zipArchive):
|
||||||
|
|
||||||
msg.attach(MIMEText(body, 'plain'))
|
msg.attach(MIMEText(body, 'plain'))
|
||||||
filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip"
|
filename = "Curie_Web_Results_Job_ID_" + str(jobID) + ".zip"
|
||||||
attachment = open((str(zipArchive) + ".zip"), "rb")
|
|
||||||
p = MIMEBase('application', 'octet-stream')
|
p = MIMEBase('application', 'octet-stream')
|
||||||
|
with open((str(zipArchive) + ".zip"), "rb") as attachment:
|
||||||
p.set_payload((attachment).read())
|
p.set_payload((attachment).read())
|
||||||
encoders.encode_base64(p)
|
encoders.encode_base64(p)
|
||||||
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
p.add_header('Content-Disposition', "attachment; filename= %s" % filename)
|
||||||
|
@ -78,15 +78,12 @@ with tempfile.TemporaryDirectory() as directory:
|
||||||
# copy(t,os.getcwd())
|
# copy(t,os.getcwd())
|
||||||
# copy(r,os.getcwd())
|
# copy(r,os.getcwd())
|
||||||
# copy(c, os.getcwd())
|
# copy(c, os.getcwd())
|
||||||
file = open(receptor_name,"wb")
|
with open(receptor_name,"wb") as file:
|
||||||
file.write(targetB)
|
file.write(targetB)
|
||||||
file.close()
|
with open(ligand_name,"wb") as file:
|
||||||
file = open(ligand_name,"wb")
|
|
||||||
file.write(ligandB)
|
file.write(ligandB)
|
||||||
file.close()
|
with open("config.txt","wb") as file:
|
||||||
file = open("config.txt","wb")
|
|
||||||
file.write(configB)
|
file.write(configB)
|
||||||
file.close()
|
|
||||||
os.system("docker run --rm -v ${PWD}:/results -w /results -u $(id -u ${USER}):$(id -g ${USER}) navanchauhan/curie-cli -r %s -l %s -c config.txt -dpi" % (receptor_name,ligand_name))
|
os.system("docker run --rm -v ${PWD}:/results -w /results -u $(id -u ${USER}):$(id -g ${USER}) navanchauhan/curie-cli -r %s -l %s -c config.txt -dpi" % (receptor_name,ligand_name))
|
||||||
#copy("report.pdf",f)
|
#copy("report.pdf",f)
|
||||||
z = "Curie_Web_Result_"+str(jobID)
|
z = "Curie_Web_Result_"+str(jobID)
|
||||||
|
|
Loading…
Reference in New Issue