Python: Die Fehlermeldung einer Ausnahme erhalten

In python 2.6.6, wie kann ich einen Screenshot des Fehlers Meldung einer Ausnahme.

IE:

response_dict = {} # contains info to response under a django view.
try:
    plan.save()
    response_dict.update({'plan_id': plan.id})
except IntegrityError, e: #contains my own custom exception raising with custom messages.
    response_dict.update({'error': e})
return HttpResponse(json.dumps(response_dict), mimetype="application/json")

Diese scheint nicht zu arbeiten. Ich:

IntegrityError('Conflicts are not allowed.',) is not JSON serializable

InformationsquelleAutor der Frage Hellnar | 2010-12-16

Schreibe einen Kommentar