Give a traceback in the log

This commit is contained in:
Robert Miles 2019-11-12 16:32:16 +00:00
parent a7f6451921
commit ab1677893b
1 changed files with 7 additions and 3 deletions

View File

@ -1,13 +1,17 @@
#!/usr/bin/python3
import utils,sys,subprocess
import utils,sys,subprocess,traceback
utils.setcwd("/home/anonhmmst")
email = utils.input()
def log(x):
with utils.open("log.txt","a") as f:
f.write(x+"\n")
try:
email = utils.input()
except:
errcls,e,tb = sys.exc_info()
log(traceback.format_exception_only(errcls,e))
title = email.get("Subject")
payload = email.get_payload()