AttributeError: How to list existing attributes?

Thomas Guettler guettli.usenet at
Wed Sep 19 17:08:29 CEST 2007

Diez B. Roggisch wrote:

> Thomas Guettler wrote:
>> Hi,
>> how can you list the attributes of an object if you catch an
>> AttributeError?
>> I couldn't find a reference in the exception object, which
>> points to the object.
>> I want to call dir() on the object to list the user the known
>> attributes.
>> Is there a way to find the object by inspecting the stacktrace?
> By looking at the code at the line the stacktrace lists? And at least for
> me, there is a type-information as well:


I  want to customize the debug tracebacks displayed in django.
It is not to find one particular error. That's why changing the
source is not a solution.


Thomas Güttler,
E-Mail: guettli (*) thomas-guettler + de
Spam Catcher: niemand.leermann at

More information about the Python-list mailing list