Parsing email attachments: get_payload() produces unsaveable data

dpapathanasiou denis.papathanasiou at gmail.com
Sun Oct 4 17:16:20 CEST 2009


> And where might we be able to see that stack trace?

This is it:

Exception: ('AttributeError', '<no args>', ['  File "/opt/server/smtp/
smtps.py", line 213, in handle\n    e
mail_replier.post_reply(recipient_mbox, \'\'.join(data))\n', '  File "/
opt/server/smtp/email_replier.py", l
ine 108, in post_reply\n    save_attachments(result[2], msg_text)\n',
'  File "/opt/server/smtp/email_repli
er.py", line 79, in save_attachments\n    data_manager.upload_file
(item_id, filename, filedata)\n', '  File
 "../db/data_manager.py", line 697, in upload_file\n    if
docs_db.save_file(item_id, file_name, file_data)
:\n', '  File "../db/docs_db.py", line 102, in save_file\n    result =
file_utils.write_file(saved_file_pat
h, saved_file_name + saved_file_ext, file_data)\n'])

If you're wondering, I'm using this to capture the exception:

def formatExceptionInfo(maxTBlevel=5):
    """For displaying exception information"""
    cla, exc, trbk = sys.exc_info()
    excName = cla.__name__
    try:
        excArgs = exc.__dict__["args"]
    except KeyError:
        excArgs = "<no args>"
    excTb = traceback.format_tb(trbk, maxTBlevel)
    return (excName, excArgs, excTb)




More information about the Python-list mailing list