|
From: Michael <mi...@st...> - 2001-10-24 10:17:23
|
Nick Bower wrote:
>
> Is there any possible way to tell what exception has been raised in
> python-ldap without catching every single possibile type of
> _ldap.LDAPError?
>
> It would be really nice in example included in the python-ldap
> documentation if an exception was caught in the following general way:
>
> try:
> <connect, bind and search, as is currently shown>
> except:
> <display type of exception and its description>
>
> at the moment, there is no example code with exceptions in the
> documentation or distribution and i can't figure out how to catch one
> from the exception references provided without trying to catch every
> single possibility.
import ldap
try:
<connect, bind and search, as is currently shown>
except ldap.LDAPError,e:
print repr(e)
Well, exception instances are not really implemented completely
pythonic but it's a start.
Ciao, Michael.
|