Parsing email attachments: get_payload() produces unsaveable data

dpapathanasiou denis.papathanasiou at
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/", line 213, in handle\n    e
mail_replier.post_reply(recipient_mbox, \'\'.join(data))\n', '  File "/
opt/server/smtp/", l
ine 108, in post_reply\n    save_attachments(result[2], msg_text)\n',
'  File "/opt/server/smtp/email_repli", line 79, in save_attachments\n    data_manager.upload_file
(item_id, filename, filedata)\n', '  File
 "../db/", line 697, in upload_file\n    if
docs_db.save_file(item_id, file_name, file_data)
:\n', '  File "../db/", line 102, in save_file\n    result =
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__
        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